Welcome Guest, Not a member yet? Register   Sign In
I want to use simpleXml to create a sitemap for my website
#1

[eluser]Unknown[/eluser]
How do you go about it?

Normally I will do it this way:

$xml = simplexml_load_file('sitemap.xml');

to call the xml file you want to work on. Then use the xml elements like this:

<home>
<item>CI is the man</item>
</home>

echo $xml->home->item


So I want to to put the item values in my views: how do I put the simplexml_load_file('xml file') in my controller?


If there are more easier CI methods please do tell.
#2

[eluser]xwero[/eluser]
I don't understand the problem? Because it's a php function you can use it as you were used to.

To pass the object to the view you can do
Code:
$data['xml'] = simplexml_load_file(’sitemap.xml’);
$this->load->view('someview',$data);
and in the view you can use $xml.




Theme © iAndrew 2016 - Forum software by © MyBB