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.

Archive /

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

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

Showing news on homepage


Go to End


2 Posts   2220 Views

Avatar
abelcreative

4 Posts

31 July 2007 at 5:40am

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?

Avatar
xmedeko

Community Member, 94 Posts

31 July 2007 at 9:06am

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