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.

Customising the CMS /

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

Nested Related Pages - How


Go to End


1226 Views

Avatar
tazzydemon

Community Member, 135 Posts

10 September 2010 at 12:49am

Sirs

I have added a tab to my editor setup in Page.php like so:

$fields->addFieldToTab( 'Root.Content.Related Pages', new TreeMultiselectField( 'LocationList', 'Related Pages', 'SiteTree' ) );

It appears to work fine in the first level but in fact my related pages themselves have related pages. I need to get them as well but now I have no idea how.

I am trying to generate something like

<h3>First Level Related Page</h3>
<div>some content</div>
<h4>Second Level Related to the one just above<h4>
<h4>another Second Level</h4>

And so on. How do I recurse down the tree to get the second level pages so I can put a control on them in the template?