[plug] PHP talk last night

Mark Nold markn at enspace.com
Wed Jul 11 11:22:02 WST 2001



Writing the XML is just as hard as writing out HTML.

The parsing is simple enough to do once you get your head around the PHP 
interface. I have some examples lying around on a test machine if you are 
interested. I only played with it but havent had a use for it yet.



What i would suggest is treat XML as just another presentation method so you 
should decide on a non XML way of storing/manipulating your data in PHP.

I'd probably suggest using a 2d array. So you end up having generic functions() 
to retrieve data from you DB (or wherever) then a function that will output XML 
or whatever. If $dataset is a 2D Array (or maybe more dimensions, or maybe an 
object?) you can easily throw it around and present your data in anyway you 
feel (XML is just another presentation format)

$dataset = getData($sql); // $dataset could be a 2D array full of all your data 
plus whatever.

$xml = createOutput($dataset,"xml");
$html = createOutput($dataset,"html");
$pdf = createOutput($dataset,"pdf");

echo ????


It's not quite as easy as this as you may need to send headers to the browser 
but hopefully this makes sense.

mn


PS: The notes should go up soon :)







Mark Nold
markn at enspace.com
Senior Consultant

Change is inevitable, except from vending machines.






More information about the plug mailing list