Hi all, I have a simpleXML related question, when i save the edited .xml file it doesn't keep the html tags?? this is part of the edit and save function function editXMLnode($lang, $xmlNode, $pageTitle, $pageContent) { $xmlobj = simplexml_load_file("../assets/xml/content-".$lang."2.xml", 'SimpleXMLElement' , LIBXML_NOCDATA); foreach($xmlobj->xpath("//page[@gotoURL='".$xmlNode."']") as $found) { $found->pageTitle = $pageTitle; $found->pageContent = "<![CDATA[".$pageContent."]]>"; } $content = $xmlobj->asXML(); file_put_contents("../assets/xml/xml.xml", $content); } Code (markup): Any pointers??
ok i solved it by $content = $xmlobj->asXML(); $content = str_replace('<pageContent>','<pageContent><![CDATA[',$content); $content = str_replace('</pageContent>',']]></pageContent>',$content); $content = html_entity_decode($content); Code (markup):