Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Articles

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

Page: 1
Go to End
Author Topic: 794 Views
  • Kiran
    Avatar
    Community Member
    3 Posts

    Articles Link to this post

    Hello,
    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)?

    Regards,
    Kiran

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Articles Link to this post

    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/HomePage.ss (or whatever template
    <% control ChildrenOf(my-article-holder) %>
    // now I have children
    ..

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