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.

General Questions /

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

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

Hiding pages in the CMS tree?


Go to End
Reply


3 Posts   1431 Views

Avatar
a-tech

Community Member, 39 Posts

12 February 2009 at 1:23pm

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?

Avatar
Carbon Crayon

Community Member, 598 Posts

12 February 2009 at 2:40pm

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 :)

Avatar
a-tech

Community Member, 39 Posts

12 February 2009 at 5:35pm

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.