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.

Data Model Questions /

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

show 2° and 3° news in homepage

Go to End

4 Posts   1497 Views


Community Member, 193 Posts

9 October 2009 at 4:51am


I follow guide to show in my home page the last 3 news. If I want show the second and the third news and not the first how can I modify query?

function LatestNews($num=3) {
$news = DataObject::get_one("NewsHolder");
return ($news) ? DataObject::get("NewsPage", "ParentID = $news->ID", "Date DESC", "", $num) : false;

help please..


Forum Moderator, 5523 Posts

9 October 2009 at 12:20pm

Couple ways to do this, best would be to set the offset in the query.

DataObject::get("NewsPage", "ParentID = $news->ID", "Date DESC", "", "1,$num");

If you want to don't want to modify that query then you could skip the first in the template as well

<% control LatestNews %>
<% if First %>
<% else %>
 DO STUFF. Will skip the first one
<% end_if %>
<% end_control %>


Community Member, 193 Posts

9 October 2009 at 7:49pm

Hi Willr,

thank for your solution!!It's great!! :)


Community Member, 8 Posts

30 May 2012 at 9:33pm


could You help me regarding to showing news on home page... I'd like to get 5 latest news in one box but only one news should be displayed at the same time and news should change every 5 seconds... Could somebody help me how could I receive this goal?

Many thanks in advance