Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Problem using simplexml in controller php


Go to End


1886 Views

Avatar
D&B

Community Member, 4 Posts

25 January 2010 at 11:38am

I want to use simplexml in my controller php, but I get an error (Node no longer exists).

I suspect ->children() is calling the silverstripe function rather than the simplexml children() function.

Is there any way around this?

class TypeTester_Controller extends Page_Controller {

function MyFunction() {

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

foreach($xml->library->children() as $child) {
...
}
}
}

Thanks