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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

HomePage


Go to End


4 Posts   918 Views

Avatar
anackiy.aleksandr

Community Member, 3 Posts

4 September 2011 at 7:14am

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

Community Member, 68 Posts

5 September 2011 at 7:18am

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

Community Member, 3 Posts

5 September 2011 at 7:22am

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

Avatar
stallain

Community Member, 68 Posts

5 September 2011 at 10:25am

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