Msg#: 3222075 posted 11:30 am on Jan 17, 2007 (gmt 0)
I have a site where I want to generate the content from an XML file like this
<projects> <project id="1"> <title>this is the title for project 1</title> <description>this is the description</description> </project> <project id="2"> <title>this is the title for project 2</title> <description>this is the description</description> </project> </projects>
I want to get the project id from the url (no problem here) then open the xml file and get the information for this project.
I am having problems getting my head around how to do this with PHP (its a long time since I used it) this is with php 4.
I have tried using an xslt to transform the xml which works but i might want the description to contain <p> tags.
So I think that I need to open the xml file get the information and then load it into php variables that I can manipulte before they are displayed.
Msg#: 3222075 posted 12:51 pm on Jan 17, 2007 (gmt 0)
The website is a very simple website that the customer wants to update themselves. They have no experiance of html etc. Having discussed it with them and shown them a sample xml file they would be happy to edit this and then upload this one xml file, rather than edit html etc...
So I have create the template in PHP all I need to do now is hook up the data.
Msg#: 3222075 posted 12:58 pm on Jan 17, 2007 (gmt 0)
It'll still be easier to make a little CMS through a database or even through a text file! But anyhoo, yeah that's how to parse XML! I mean you don't even need PHP, you can use XSLTs! It doesn't matter if the XML contains html tags, you just 'include' the data within a <div>