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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

Sort back-end (BlogEntry's)


Go to End


2 Posts   1589 Views

Avatar
borriej

Community Member, 267 Posts

9 February 2011 at 3:48am

How can i sort my blogentry's by date?

Tried things like this, but its not working for me:

 SiteTree::$default_sort = 'IF("SiteTree"."ClassName" = \'BlogEntry\', LOWER("SiteTree"."DESC"), "SiteTree"."Sort")';
 SiteTree::$default_sort = 'IF("SiteTree"."ClassName" = \'BlogEntry\', LOWER("SiteTree"."Created"), "SiteTree"."Sort")';
 SiteTree::$default_sort = 'IF("SiteTree"."ClassName" = \'BlogEntry\', LOWER("SiteTree"."Created"), "SiteTree"."Created")';

The search form didn't give me much help.

Avatar
adiwidjaja

Community Member, 14 Posts

28 May 2011 at 3:38am

Late answer, but maybe someone else needs this - I found this solution:

SiteTree::$default_sort = 'IF("SiteTree"."ClassName" = \'BlogEntry\', NOW() - "SiteTree"."Created", "SiteTree"."Sort")';

Cheers,

Andy