2016-09-23, 02:31:37
Quote:PHP Code:$xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
How can I 'add' new data to the existing xml-data?
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';
if (file_exists($settingsFile)) {
$xml_settings = simplexml_load_file($settingsFile);
} else {
$xml = @new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
$xml->asXML($uriRedirectFile);
$xml_settings = simplexml_load_file($settingsFile);
}
Then you can do your $xml_settings->addChild('category');
Does that help?