21310 Posts in 5739 Topics by 2604 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1399 Views |
-
sort first by 'Sort' ASC then by ''ID' DESC

13 May 2009 at 5:58am
I want to sort first by 'Sort' ASC then by ''ID' DESC
This code only sorts by ID:
public function nextPager() {
$where = "ParentID = ($this->ParentID + 0) AND Sort > ($this->Sort + 0 )";
$pages = DataObject::get("SiteTree", $where, "Sort", "", 1);
if($pages) {
foreach($pages as $page) {
return $page;
}
}
} -
Re: sort first by 'Sort' ASC then by ''ID' DESC

13 May 2009 at 10:33am
You want:
$pages = DataObject::get("SiteTree", $where, "Sort ASC, ID DESC", "", 1);
-
Re: sort first by 'Sort' ASC then by ''ID' DESC

13 May 2009 at 11:21am
rbquirke, your idea does not work. I get a database error.
-
Re: sort first by 'Sort' ASC then by ''ID' DESC

13 May 2009 at 12:31pm
What database error are you getting?
something about an ambiguous column?
-
Re: sort first by 'Sort' ASC then by ''ID' DESC

19 May 2009 at 10:41pm
Never mind, I had a type, thanks rbquirke.
| 1399 Views | ||
|
Page:
1
|
Go to Top |


