M84 Posted March 1, 2007 Share Posted March 1, 2007 I'm developping an application in flash and when I create an image I want to save the info of that image in a xml file. After searching it seems that doing that would be better with php. But I'm kinda of a noob in terms of php and xml. So I was thinking of sending the images name, height and width to php and then edit a xml file that already exists. the xml file has a very simple structure: <gallery> <image path="images/flor.JPG" width="96" height="96" /> <image path="images/palmeiras.JPG" width="96" height="97" /> </gallery> I already tried SimpleXML, but I dont know how to edit the actual xml file. This is the php code I have now: <?php if (file_exists('images.xml')) { $sxo = simplexml_load_file('images.xml'); $new_image = $sxo->addChild("image"); $new_image->addAttribute("path","image.jpg"); $new_image->addAttribute("width","97"); $new_image->addAttribute("height","100"); var_dump($sxo); } else { exit('Failed to open test.xml.'); } ?> It reads my xml file, and adds a new child, but how do I update that info on the actual xml file? Can somebody please help me? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.