21293 Posts in 5733 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » I need the children of a urlsegment to inherit a theme
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
|
Page:
1
|
Go to End | |
| Author | Topic: | 1192 Views |
-
I need the children of a urlsegment to inherit a theme

22 December 2009 at 8:42pm
Hi,
The code below works for the one page:
if(($this->URLSegment) == ''SomePage") {
SSViewer::set_theme('newTheme');
}else{
SSViewer::set_theme('default');
}How can I get 'newTheme' to be inherited by the children of 'SomePage'?
Thanks,
Todd
-
Re: I need the children of a urlsegment to inherit a theme

23 December 2009 at 12:45pm
this works for the next level down:
if($this->URLSegment == ''SomePage" || $this->Parent()->URLSegment == "SomePage") {
SSViewer::set_theme('newTheme');
}else{
SSViewer::set_theme('default');
}beyond that, you should set up a recursive function to recurse through the parent chain, looking for 'somepage' as the url until you hit a Page ID of 0.
-Chris
| 1192 Views | ||
|
Page:
1
|
Go to Top |

