2016-09-23, 01:49:45
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'
How can I 'add' new data to the existing xml-data?
Thanks
teazmo
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){
$xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
if(isset($_POST['new_category']))
{
$c_child = $xml->addChild('category');
$c_child->addAttribute('name', $_POST['title']);
}
if(XMLsave($xml, HelloWorldFile))
{
echo '<div class="updated">Updated!</div>';
}
How can I 'add' new data to the existing xml-data?
Thanks
teazmo