Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Showing news on homepage

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1557 Views
  • abelcreative
    Avatar
    4 Posts

    Showing news on homepage Link to this post

    I have a little box that shows the news clips on the hompage - however, I don't want it to show more than 3 at a time - is there a way to do that?

  • xmedeko
    Avatar
    Community Member
    94 Posts

    Re: Showing news on homepage Link to this post

    look at DataObject::get() method, there's a limit parameter, so you do something like
    [code php]
    function GetLatest3News() {
    return DataObject::get('NewsArticleClass',$filter,....,$limit=3);
    }

    and in the template just $GetLatest3News

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