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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

HomePage


Reply

4 Posts   577 Views

Avatar
anackiy.aleksandr

4 September 2011 at 7:14am Community Member, 3 Posts

Hello! I am a beginner. I hope very much for your help!
I have TourPage and TourHolder. I want to show on the home page of last 6 pages TourPage. I copied the output function of Tutorial2.

function LatestNews($num=6) {
$news = DataObject::get_one("TourHolder");
return ($news) ? DataObject::get("TourPage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
}

I understand there appears dated. How do I change this to select the necessary things to do not by date added, and the ID page in the database?

Avatar
stallain

5 September 2011 at 7:18am Community Member, 61 Posts

Hello, I'm not sure of what you actually need :
- Do you want another way of sorting the "TourPage" pages appearing on your home page ?
- Or do you want to be able to manually select the 6 pages appearing on your home page from the CMS ?

Stan

Avatar
anackiy.aleksandr

5 September 2011 at 7:22am Community Member, 3 Posts

Hello! I want another way to sort "TourPage" pages.

Avatar
stallain

5 September 2011 at 10:25am Community Member, 61 Posts

OK, you just have to replace "Date" by any other field of your page : "ID DESC", "Created DESC", "Title DESC", etc.