. I have been able to pull the content out of the CDATA field with
How do you know which banner you are editing at any given time? I was expecting to see each banner node with a unique id attribute so that when you edit, you would know which node to update. Where's your attempted update code?
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
assuming you are POSTing from a form with <input name='homesCopy'> try:
<?php
$doc = new DomDocument();
$file = "spice.xml";
$doc->load($file);
$xPath = new DomXPath($doc);
$homesCopy = $xPath->query("//sections/homesCopy/banners")->item(0);
if( isset($_POST['homesCopy']) ){
$homesCopy->firstChild->nodeValue=$_POST['homesCopy'];
$doc->save($file);
}
echo $homesCopy->nodeValue;
?>
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244