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

Displaying the related pages


Go to End


3 Posts   940 Views

Avatar
kindleman.com.au

Community Member, 70 Posts

6 September 2011 at 12:57pm

Sorry to ask such a noob question, but i can't find it in the google or the docs. -

Pages in the cms come with a related pages field - how do i display these in the template.

thanks

will

Avatar
kindleman.com.au

Community Member, 70 Posts

8 September 2011 at 10:05am

hmm, ok. Still tricky.

what i am doing at the mo is this:

<% control RelatedPages %>
    $Title
<% end_control %>

But that just outputs: "#2 #3 #4"

So thats probably the id's of the RelatedPageLink table. so, how do i access the page's fields? Is there a way to output all the fields available in a control as a debug thing?

Thanks

will

Avatar
kindleman.com.au

Community Member, 70 Posts

9 September 2011 at 4:58pm

self rescue!

<% if RelatedPages %>
<h3>Related Pages</h3>
<% control RelatedPages %>
<h4><a href='$RelatedPage.link'>$RelatedPage.Title</a></h4>
<p>$RelatedPage.Content.FirstParagraph </p>
<a href='$RelatedPage.link'>Read More</a>
<% end_control %>
<% end_if %>