Jump to:

23376 Posts in 18214 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Select Sub Page to display in 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: 746 Views
  • bunheng
    Avatar
    Community Member
    77 Posts

    Select Sub Page to display in parent page Link to this post

    Hi there,

    I have the following page tree:

    1. Province
    1.1.Project
    - Activities
    -- activity one
    -- activity two
    -- activity three

    1.2.Project
    - Activities
    -- activity one
    -- activity two
    -- activity three

    I would like to select all page under activities belong to all projects to display
    within page parent page province.

    Could you please let me know if there is any trick.

    Regards,
    Bunheng

  • FullWebService
    Avatar
    Community Member
    38 Posts

    Re: Select Sub Page to display in parent page Link to this post

    Put the following function in your Province controller:

    function ActivitiesList() {    
    $records = DataObject::get("Activity"); // assuming Activity is the right classname for your activity pages
    }

    Now you can list all your activities in your Province theme file with a simple control.

    <% control ActivitiesList %>
    <h2>$Title</h2>
    $Content
    <% end_control %>

    Hope this helps.

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