941 Posts in 272 Topics by 292 members
Forum Module
SilverStripe Forums » Forum Module » Order of items different on admin and published site.
Discuss the Forum Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1169 Views |
-
Order of items different on admin and published site.

3 October 2009 at 8:30pm
The problem I am facing is that the items I have added in admin are published in different order on site. i.e I want to say is like this...
In admin
- News
-- Article1
-- Article2
-- Article3and they are published in this order.
- News
-- Article3
-- Article1
-- Article2Help me to solve this problem. I want the order of items same in both admin and published site.
-
Re: Order of items different on admin and published site.

12 October 2009 at 8:31pm
You need to write a function to do the sorting...
this is taken from Tutorial 2
function LatestNews($num=5) {
$news = DataObject::get_one("ArticleHolder");
return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
}$records = DataObject::get($obj, $filter, $sort, $join, $limit);
The "Date DESC" is the part doing the sorting, if left blank, it's using your SiteTree order. ASC order is the default, so "Date ASC" and "Date" are the same. You can sort by "Created DESC" or "LastEdited" or fields in your static $db = array(), etc.
| 1169 Views | ||
|
Page:
1
|
Go to Top |


