Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Pages order in menu/cms

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

Page: 1 2
Go to End
Author Topic: 4873 Views
  • Tonyair
    Avatar
    Community Member
    81 Posts

    Re: Pages order in menu/cms Link to this post

    Try it =)
    class ArticleHolder_Controller extends Page_Controller {

       /**
       * Get the latest 2 news articles, allowing us to get more
       *
       * @return DataObjectSet|false The DataObjectSet of the news articles you're looking at or boolean false if there aren't any news articles
       **/
       function NewsArticles() {
          if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
          $SQL_start = (int)$_GET['start'];
          $doSet = DataObject::get(
             $callerClass = "ArticlePage",
             $filter = "`ParentID` = '".$this->ID."'",
             $sort = "Date DESC",
             $join = "",
             $limit = "{$SQL_start},10"
          );
          return $doSet ? $doSet : false;
       }

    }

  • Terry Apodaca
    Avatar
    Community Member
    109 Posts

    Re: Pages order in menu/cms Link to this post

    I've tried several of these, and a few of my own. I have to say that they are all very inconsistent. VERY inconsistent....so I just tell the client that the menu will show up in the same order it does in the tree of the CMS. If they want it changed, they can click the Drag and Drop Reordering to place them in the order they want. so my sort is empty:

    static $default_sort = '';

  • johnp
    Avatar
    Community Member
    8 Posts

    Re: Pages order in menu/cms Link to this post

    Did any body find an answer to this? been rattling my brain with this problem!
    If so could you please post

  • Fountain
    Avatar
    Community Member
    1 Post

    Re: Pages order in menu/cms Link to this post

    This thread put me on the right track (I'm using SS 3). Open your site's _config.php file and add the following line:

    SiteTree::$default_sort = 'Title';

    Replace Title with whatever column you want to sort the tree on.

    4873 Views
Page: 1 2
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.