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

Select Sub Page to display in parent page


Go to End


2 Posts   1758 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.