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.

General Questions /

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

Select Sub Page to display in parent page


Reply


2 Posts   785 Views

Avatar
bunheng

Community Member, 78 Posts

3 June 2011 at 8:36pm

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

Avatar
FullWebService

Community Member, 38 Posts

7 June 2011 at 10:01pm

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.