I'm working on xml.php file structured below:
<?php
$xmlstr = <<<'XML'
<?xml version='1.0' standalone='yes'?>
<root>
<subroot>
<![CDATA[
... some php code here ...
]]>
</subroot>
</root>
XML;
?>
I want to add the below php code between CDATA so that we can call it later through index.html file:
<?php
include $_SERVER['DOCUMENT_ROOT'].'xml.php';
$template = new SimpleXMLElement($xmlstr);
echo $articles->article[0]->name;
?>
However, it doesn't work like this and have run out of ideas on how can we make it to work. Any suggestions?
<?xml version='1.0' standalone='yes'?><root><![CDATA]]></root>