setThemeByPath (use for sections, not just single pages?)
Permalink
Hi - I'm trying to use this method to set my themes for different sections within my site. I'm not having any luck; it seems to work fine for single pages, but doesn't cascade down through the structure of my site.
For example, I have:
$p = Page::getByID(HOME_CID);
$theme = $p->getCollectionThemeObject();
$default = $theme->getThemeHandle();
$v = View::getInstance();
$v->setThemeByPath('/esoc', "ESOC");
$v->setThemeByPath('/limnology', "CIRES");
$v->setThemeByPath('/eo', "ESOC");
I want the theme ESOC to be applied to the /esoc/ directory and everything within it. However, when I add the trailing slash behind 'esoc' it doesn't work. If I remove the trailing slash, it works only for the page /esoc/ but no subsequent pages beneath it.
Does anyone know of a way to make this work for sections and their contents?
Thanks for any help you can provide!
-Kiki
For example, I have:
$p = Page::getByID(HOME_CID);
$theme = $p->getCollectionThemeObject();
$default = $theme->getThemeHandle();
$v = View::getInstance();
$v->setThemeByPath('/esoc', "ESOC");
$v->setThemeByPath('/limnology', "CIRES");
$v->setThemeByPath('/eo', "ESOC");
I want the theme ESOC to be applied to the /esoc/ directory and everything within it. However, when I add the trailing slash behind 'esoc' it doesn't work. If I remove the trailing slash, it works only for the page /esoc/ but no subsequent pages beneath it.
Does anyone know of a way to make this work for sections and their contents?
Thanks for any help you can provide!
-Kiki
Did you ever figure this out?
Sadly no. I had to apply the theme to each section as I created it from the within the Dashboard/sitemap area.
Never got any help from anyone else on it. Are you facing the same issue?
Never got any help from anyone else on it. Are you facing the same issue?
Damn. I need to do this to a blog section, in which case there's no way for me to know the full paths to each page. Wish they used a wildcard character on this. Maybe I can modify script.
Thanks for the reply!
Thanks for the reply!