PDA

View Full Version : Getting PHP to parse a variable


optimism_
05-04-2003, 10:25 PM
i am using a template system for my site, and as such there is a single page which contains the design, and a function to get the page data from an XML file and print it to the page, as such

$hash = getData("filename.xml");
...
echo $hash['body_text'];

however, my site has grown more complex, and i would really like to be able to use PHP in the XML data files. However i cant do this straight off, as the variable just contains the text which is printed to the browser at the right point. What i really need is for php to parse the contents of the variable $hash['body_text'] as if it were another file. I dont really want to dump the xml data to another file and just include() it and delete it, because that seems too impractical.

Is there any function in phps library that will parse the variable for PHP tags?

thanks. optimism_

duniyadnd
05-05-2003, 03:56 PM
http://www.php.net/manual/en/ref.xml.php

Scroll down, you'll have a bunch of options...

Sorry, haven't used these functions enough to tell you about them.

Duniyadnd

optimism_
05-06-2003, 08:15 PM
thanks - with a slight modification to my xml library, this was exactly what i needed