xml data gets overwritten - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8) +--- Thread: xml data gets overwritten (/showthread.php?tid=8742) |
xml data gets overwritten - teazmo - 2016-09-23 Hello, So far I've created my own very simple plugin. It has got a form to fill in a title or in this case a category and an overview of all titles. After submitting the title with my form the data gets saved to my xml-file. So far thats fine, but when I try to add another new entry the previous data gets overwritten. I added following function to my plugin class called 'helloworld' PHP Code: public function processData($edit=null){ How can I 'add' new data to the existing xml-data? Thanks teazmo RE: xml data gets overwritten - jlyon1515 - 2016-09-23 Quote: Maybe I'm not reading your question right, but it seems to me that you need to change the line that I quoted above. You're making the file from scratch every time according to that line. Do something like: PHP Code: $settingsFile=GSDATAOTHERPATH .'helloworld.xml'; Then you can do your $xml_settings->addChild('category'); Does that help? RE: xml data gets overwritten - shawn_a - 2016-09-23 check theme.php for example You want to load the xml ( if exist ) then modify nodes If exist you can just get the xml from file, or create it node by node if not. PHP Code: $xml = getXML($path . $file); |