3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 419 Views |
-
[solved] sort all subpages by date(subpages seperated in 2 categories on one site)

26 August 2011 at 8:31am
Hi,
if got this site constructionReferencesPage.php - http://pastie.org/2429726
ReferencePage.php - http://pastie.org/2429729
ReferencesPage.ss - http://pastie.org/2429730It looks like this http://www.jaypac.de/image.php?file=736847 and this http://www.jaypac.de/image.php?file=828600
The References are seperated in New and Old ones. But not sorted by Date. Cause i don't know how :/
I want that all the New References are sorted by date. latest ones at first. and the same with the old refernces.
Can someone tell me how?
Thx Benni
-
Re: [solved] sort all subpages by date(subpages seperated in 2 categories on one site)

26 August 2011 at 11:23pm
I'm not quite sure about this - links to a page that has <scr + ipt links and a somewhat erotic popup, but don't seem to make the question any clearer?
Still - since you're not a new member, maybe we should give you a change to explain?
-
Re: [solved] sort all subpages by date(subpages seperated in 2 categories on one site)

27 August 2011 at 7:34am Last edited: 27 August 2011 7:37am
hmm perhaps it's a little bit clearer if you visit the site
http://hobedesign.de/referenzen/
E-Mail: silverstripe
Password: ss123there you can see that the references are seperated into new and old. but they aren't sorted by date, they are shown in the order i created them. and i don't know how to sort the new ones and the old ones.
do you know now what i mean?
benni
-
Re: [solved] sort all subpages by date(subpages seperated in 2 categories on one site)

27 August 2011 at 9:29pm Last edited: 27 August 2011 9:30pm
OK, I get it
I wasn't sure if they were your pages the links referred to, so especially with the popup and all, they did look somewhat spammish. You might want to remove these links from your earlier post...
As for your question: I would create a custom function getReferences() in your ReferencesPage_controller, that retreives the ReferencePages in the correct order. Then use <% control References %> instead of <% control Children %> in your template.
You can then sort them by Date descending. Something like (simplest version thinkable):
public function getReferences() {
return DataObject::get('ReferencePage', "ParentID = '$this->ID'", 'Date DESC');
} -
Re: [solved] sort all subpages by date(subpages seperated in 2 categories on one site)

28 August 2011 at 7:49am
Thanks!
I tried this function before too. but i made one mistake, i put it after <% control children %>, damn!
now it works fine.
| 419 Views | ||
|
Page:
1
|
Go to Top |

