Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Displaying the related pages

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

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

Page: 1
Go to End
Author Topic: 519 Views
  • kindlemanwill
    Avatar
    Community Member
    67 Posts

    Displaying the related pages Link to this post

    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

  • kindlemanwill
    Avatar
    Community Member
    67 Posts

    Re: Displaying the related pages Link to this post

    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

  • kindlemanwill
    Avatar
    Community Member
    67 Posts

    Re: Displaying the related pages Link to this post

    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 %>

    519 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.