SimpleXML syntax problem
Posted: Tue Oct 10, 2006 3:46 am
Hey guys, lovely rainy morning, perfect for a spot of SimpleXML and PHP.
I'm building an XML/PHP Content Management System at the moment (pretty small scale) and I've found most of the programming surprisingly straight forward.
However, from the home page (which displays all the articles in the CMS by parsing the XML), I've got links to edit the articles, taking you to an editing page.
The editing page works fine and does everything it should, but I'm having trouble getting a variable from the URL to the XML syntax.
Confused? me too! here's how it looks...
the last bit, in which the var $section looks to a specific part of the XML for parsing just doesn't seem to want to take a variable in those square brackets. During testing, placing numbers between them i.e.
works fine, but if I can figure out how to get that little number in that little place, I'd be a lot happier.
Thanks in advance, and hope the weather gets better!
I'm building an XML/PHP Content Management System at the moment (pretty small scale) and I've found most of the programming surprisingly straight forward.
However, from the home page (which displays all the articles in the CMS by parsing the XML), I've got links to edit the articles, taking you to an editing page.
The editing page works fine and does everything it should, but I'm having trouble getting a variable from the URL to the XML syntax.
Confused? me too! here's how it looks...
Code: Select all
$num = $_GET['edit'];
$xmlDoc = "xmlDocument_Articles.xml";
$article = simplexml_load_file($xmlDoc);
$section = $article->slide[$num];Code: Select all
$section = $article->slide[5];Thanks in advance, and hope the weather gets better!