21282 Posts in 5730 Topics by 2601 members
General Questions
SilverStripe Forums » General Questions » Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 5768 Views |
-
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

17 January 2009 at 4:21pm Last edited: 17 January 2009 4:22pm
To disable the rendering of the HTML try this, it worked for me. Someone else confirm this is right, I just started hacking the code two days ago so I might be missing something.
In the Saphire/core/Model/Hierachy.php file you'll find a getChildrenAsUL function line number 37. If you insert after
foreach($children as $child) {
these lines of code
if(!$child->canEdit())
continue;the HTML for the tree nodes won't render.
-
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

18 January 2009 at 3:06am
@DaAmazing1 : works fine.
doesn't solve my problem of subpages though...
-
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

18 January 2009 at 6:20am
After further research that was a pretty bad solution, that class is used to decorate other classes so who knows what gets broken by doing that. I found a better easier solution that solves the html rendering and the subpages:
In the cms/code/LeftAndMain.php on line number 388 you'll find a $sitetree variable being set, change that to this:
$siteTree = $obj->getChildrenAsUL("", '
($child->canEdit()?"<li " . ($child->canEdit()?"id=\"record-$child->ID\"":"") . " class=\"" . $child->CMSTreeClasses($extraArg) . "\">" .
"<a href=\"" . ($child->canEdit()?Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID):"javascript:;;;") . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"' . _t('LeftAndMain.PAGETYPE','Page type: ') . '".$child->class."\" >" .
($child->canEdit()?($child->TreeTitle()):" ") .
"</a>":"")
' "</a>"
'This is a better solution because your not messing with the core code and should only affect the Sitetree. All the decorator Hierarchy class does a simple php eval on the template so the inline ifs should solve the issue. The tree looks a bit messed up, but everything works I'm sure you guys can figure out a way to hack the css to fix the tree. Also the code is a bit messy I was trying several different things so you might want the extraneous inline ifs deleted.
-
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

22 January 2009 at 12:38am
well done, I have not tested your code but had looked at this line of code and tried to implement what you did, this is exactly the place to make this modification happen
-
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

9 June 2009 at 1:42pm
I have tested your code and works!
Is possible add this to SS distribution?
Thanks that is perfect for me.
-
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

10 June 2009 at 12:30pm
yes, we've been using that code since January and it's worked perfectly =)
-
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

30 July 2009 at 9:25pm
hi, quick note on upgrade for 2.3.2, change occurs in cms/code/LeftAndMain.php : line 517
$siteTree = $obj->getChildrenAsUL("", '
($child->canEdit()?"<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" .
"<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"' . _t('LeftAndMain.PAGETYPE','Page type: ') . '".$child->class."\" >" .
($child->TreeTitle()) .
"</a>":"") -
Re: Hidng Site Tree Pages and Tabs in the Editor Content View of the CMS?

30 July 2009 at 9:58pm
Great, thanks Erwanpia. This should really get considered for the core, are there any relevant tickets open?
| 5768 Views | ||
| Go to Top | Next > |




