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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Tutorial 2: Ordering the news and number of displayed items

Go to End

3 Posts   1748 Views


Community Member, 32 Posts

15 August 2008 at 3:32pm

Hi guys,

Maybe I've been awake too long staring at this screen but I swear I cannot see anywhere in Tutorial 2 that shows how to order the news posts!

The problem I have: Using the news post setup (exactly as show in tutorial 2), whenever I create a new ArticlePage it orders itself (in the CMS and on the news page) under the previous posts... how do I get them to run in order from most recently posted to oldest?

Also... is there a way (already documented preferably) to show say.. the last 10 news items only, and have the rest off the page in record sets (im not sure if thats the right terminology sorry), eg: small number at the bottom of them page where you can go back and see previously posted news.

Thanks in advance....


Forum Moderator, 5523 Posts

15 August 2008 at 5:03pm

I think it shows this code in the tutorial

DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num).

Which translates to

GET ALL of the 'ArticlePages' whose Parent = X. Order it by the Date Desc. And $num is the limit of how much you want to limit it to. If you want all the pages you can just get rid of the last parameter - this will get all. If you make $num 10 then it will get the latest 10.

So the format in SQL terms is


Join is more compilcated so you can leave it blank. See


Community Member, 32 Posts

15 August 2008 at 5:26pm

Thanks mate, got it sorted now with your help!