Page 1 of 1

PHP Export Class

Posted: Mon Apr 10, 2006 2:40 pm
by Todd_Z
Has anyone seen a script that creates various export formats, specifically tab, csv, xml, html, sql?

Re: PHP Export Class

Posted: Mon Apr 10, 2006 3:18 pm
by Roja
Todd_Z wrote:Has anyone seen a script that creates various export formats, specifically tab, csv, xml, html, sql?
Tab and csv is relatively simple - you iterate over the array, and at each element, append a tab or a comma. Done.

XML and HTML are considerably more challenging. XML requires a valid parse tree, and HTML is.. well, a mess.

One library for all of those wouldn't make much sense.

Posted: Mon Apr 10, 2006 4:28 pm
by Christopher
You could also use a Template class and templates for each export type. Just select the template for that type of export and loop through the data.

Posted: Mon Apr 10, 2006 8:38 pm
by Todd_Z
yea, i guess i'll just put together a lil class for it.