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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[Solved] Access a controller when inside a loop (ChildrenOf)


Go to End


569 Views

Avatar
Vlad Belfort

Community Member, 55 Posts

25 May 2016 at 4:16am

Note: I wrote this question on SO originally and it'd take me forever to reformat it for these forums so for full description please visit link

When using ChildrenOf I am unable to use any controllers within it. Even a controller that echos 'string' doesn't output anything while inside that loop but works when I put it outside of it. The controllers for the page type that I'm getting using that loop don't work either (I thought they would)...

I need to get some data from a series of pages as well as info from a DataObject each of those pages is associated with - ChildrenOf gets the data for children but not the DataObject and I can't query the DataObject because the controller doesn't work in the loop...

How do I get both sets of data?

Please visit this link for full description (StackOverflow)