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.

Template Questions /

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

Latest News show all in News section

Go to End

2 Posts   1398 Views


Community Member, 2 Posts

29 September 2010 at 5:35am

I am using and Article Holder to show the latest news for a website, but I only wish to show the first three. Right now it is showing every article in the News section.

Is there anyway to only show the first 3?


Community Member, 135 Posts

29 September 2010 at 2:42pm

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

<% control LatestNews %>
<% end_control %>