Jump to:

23007 Posts in 11866 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Sort back-end (BlogEntry's)

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

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

Page: 1
Go to End
Author Topic: 1088 Views
  • borriej
    Avatar
    Community Member
    267 Posts

    Sort back-end (BlogEntry's) Link to this post

    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.

  • adiwidjaja
    Avatar
    Community Member
    14 Posts

    Re: Sort back-end (BlogEntry's) Link to this post

    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

    1088 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.