Hi guys,
How can I choose it's position based on it's sibblings when I add a child node ?
Here is an example :
<?php
$_XML = ' <Test>
<Menu>
<Link href="page1.htm" />
<Link href="page2.htm" />
<Link href="page4.htm" />
</Menu>
</Test>';
$_RenderedXML = new SimpleXMLElement($_XML);
//Add a new Link node
$_NewLink = $_RenderedXML->Menu->addChild("Link");
$_NewLink->addAttribute("href", "page3.htm");
echo $_RenderedXML->asXML();
?>
This will render the XML with the new node below it's sibbling. I would like to specify it's position.
addChild("Link", 2) //or something.
Any guess ?