Jump to:

23452 Posts in 18901 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Hiding pages in the CMS tree?

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: 1206 Views
  • a-tech
    Avatar
    Community Member
    39 Posts

    Hiding pages in the CMS tree? Link to this post

    I have a site with over 6000 pages of products, and I'm successfully using the modeladmin to deal with them appropriately, however, this amount of pages really shows down the CMS when I want to edit single blog/news items on the site.

    Is there a way to remove them from the site tree in the CMS part, so that that admin area loads quicker and I can just deal with the products using Modeladmin only?

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Hiding pages in the CMS tree? Link to this post

    Hi a-tech

    this thread might help: http://www.silverstripe.org/general-questions/show/251987?start=8

    It's not be exactly what ur looking for but might have some clues

  • a-tech
    Avatar
    Community Member
    39 Posts

    Re: Hiding pages in the CMS tree? Link to this post

    thanks aram,

    I got some help from sam minnee on this and Works a treat!!

    LeftAndMain::getSiteTreeFor() does most of the work - this is called in other places, passing "SiteTee", "Folder", or "Group" as necessary.
    It's called by CMSMain::SiteTreeAsUL().

    It's currently like this:

          $obj = $rootID ? $this->getRecord($rootID) : singleton($className);
          $obj->markPartialTree(30, $this);
          if($p = $this->currentPage()) $obj->markToExpose($p);


    You can probably change it to have a call to setMarkingFilter. I woudl recommend that you make this change by duplicating the whole LeftAndMain::getSiteTreeFor() in either CMSMain, or your own custom subclass of LeftAndMain.

          $obj = $rootID ? $this->getRecord($rootID) : singleton($className);
    -->    $obj->setMarkingFilter('ShowInCMS', 1);
          $obj->markPartialTree(30, $this);
          if($p = $this->currentPage()) $obj->markToExpose($p);


    This means that the tree will only show objects where $dataObj->ShowInCMS = 1;

    public $ShowInCMS = 1; // on Page.php

    public $ShowInCMS = 0; // on the class to exclude from the CMS.

    1206 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.