Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
xml data gets overwritten
#2
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?
Reply


Messages In This Thread
xml data gets overwritten - by teazmo - 2016-09-23, 01:49:45
RE: xml data gets overwritten - by jlyon1515 - 2016-09-23, 02:31:37
RE: xml data gets overwritten - by shawn_a - 2016-09-23, 02:34:04



Users browsing this thread: 1 Guest(s)