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