Jump to content

xclntdesign

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

xclntdesign's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wow! You made it seem so simple. That indeed did the trick. I think that was the one variation I didn't try. Thanks!
  2. I've been working on a script to open an XML file, insert a node, then save the file again. $url = '../v3flashslideshow/slideshow_data0.xml'; $xml = new DomDocument(); $xml->formatOutput = true; $xml->preserveWhitespace = false; $xml->load($url); $xpath = new DOMXPath($xml); $first = $xpath->query('//galleries/gallery/img')->item(0); // create node $new = $xml->createElement("img"); $xml->appendChild($new); $image = $xml->createAttribute("src"); $new->appendChild($image); $new->setAttribute("src", $_GET['image']); $first->parentNode->insertBefore($new, $first); echo $xml->save($url); The above code works except for the fact that it adds the new node twice. When I change the last line to: echo $xml->saveXML(); to display the code on the screen, it works fine, with the new node added only once. I've tried many different work arounds, and nothing seems to work. Anyone have any ideas? Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.