Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Displaying Child Contents on a Parent Page

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: 1542 Views
  • kerwei
    Avatar
    Community Member
    5 Posts

    Displaying Child Contents on a Parent Page Link to this post

    Hi guys,

    I'm new to website construction, and I need some help with an assignment I'm working on. I have created a Home Page, with a child page under it. This child page is not accessible from the menu and is hidden in search as well. My intention is to have the contents of this child page displayed in a small section on the left sidebar of the Home Page.

    Can somebody please let me know how I can achieve this in the simplest way possible? Thanks in advance!

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: Displaying Child Contents on a Parent Page Link to this post

    <% control AllChildren %> can be used to access data from Children even if Show in Menus/Serach is off

  • kerwei
    Avatar
    Community Member
    5 Posts

    Re: Displaying Child Contents on a Parent Page Link to this post

    hi zenmonkey. thanks for the reply!

    i would like to ask another question if you don't mind. if the HomePage has more than one child, how do i pick a specific child to be displayed instead of all of them?

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: Displaying Child Contents on a Parent Page Link to this post

    Try:
    <% control Page(child-page-urlname) %>

    <% end_control %>

    where 'child-page-urlname' is the string from the page url.

  • kerwei
    Avatar
    Community Member
    5 Posts

    Re: Displaying Child Contents on a Parent Page Link to this post

    doesn't work though. it returned a blank white page after i inserted those lines.

  • kerwei
    Avatar
    Community Member
    5 Posts

    Re: Displaying Child Contents on a Parent Page Link to this post

    *bump*

    hi, guys. i'm still currently stuck with this. in fact this is the final piece of my website but i can't seem to get it working. tried the method by brucep but as i've reported, i got only a blank page in return after making the changes.

    anybody has more suggestions on how i can get this done? thanks in advance again!

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: Displaying Child Contents on a Parent Page Link to this post

    Blank pages are usually calls to Bad Functions or ones that return bad data. Since the Child Control is built in you may either have the URL parameter written wrong or a problem with one of the Data Calls in the control. You could always structure the call in the template like

    <% control AllChildren %>
    <% if Title=x %>
    Your Template Goes Here
    <% end_if %>
    <% end_control %>

  • kerwei
    Avatar
    Community Member
    5 Posts

    Re: Displaying Child Contents on a Parent Page Link to this post

    hi zenmonkey, that solved the problem! thank you so much! now i can finish the project. =)

    1542 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.