3093 Posts in 875 Topics by 654 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 972 Views |
-
show 2° and 3° news in homepage

9 October 2009 at 4:51am
Hi!
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..
-
Re: show 2° and 3° news in homepage

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 %> -
Re: show 2° and 3° news in homepage

9 October 2009 at 7:49pm
Hi Willr,
thank for your solution!!It's great!!
-
Re: show 2° and 3° news in homepage

30 May 2012 at 9:33pm
Hi,
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
Peter
| 972 Views | ||
|
Page:
1
|
Go to Top |



