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.

Customising the CMS /

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


Go to End

2 Posts   1017 Views


Community Member, 3 Posts

20 March 2010 at 9:39am

I have just migrated from CMSMS to SilverStripe.
I have a newbie question:
How would one make it so all pages (which simply contain an "article" and no other data) would appear when I went to the parent page (for instance the Homepage)?



Forum Moderator, 5523 Posts

20 March 2010 at 1:11pm

Lots of ways to do this. One is to have your own function like this in your HomePage.php file.

// mysite/code/HomePage.php (or Page.php)
function AllMyArticles() {
return DataObject::get('MyArticleClass');

Then you have a control in your template <% control AllMyArticles %> which will loop over all your articles. Another way to do it is if all your articles are in 1 place then you can use the ChildrenOf function in the template

// themes/yourtheme/templates/Layout/ (or whatever template
<% control ChildrenOf(my-article-holder) %>
// now I have children