change theme by node or path? like administrator can have a different theme.

webengr - June 19, 2007 - 23:59

With drupal 5.x the "Admistration Theme" can be set so that the administration pages
can use a different theme. A good feature, especially if the default theme goes crazy.

My question, is there a way to have a different theme used for different parts of the website
in a similar fashion?

for example, say the site is www.foomall.com and I want a different theme for some of the sub directories,
like something green/tropical for www.foomall.com/dayspa and maybe something blue theme for www.foomall.com/poolsupplies

Is there an existing module that I missed that can do this? Is this a BAD idea or okay?

In principle it seems like a good idea....

TIA.

taxonomy or node based

Tistur - June 20, 2007 - 00:32

Well, you should at least look at:

http://drupal.org/project/taxonomy_theme
http://drupal.org/project/referer_theme
http://drupal.org/project/viewtheme

View - Theme might be what you're looking for, I haven't used it myself. My first reaction would be to create paths and use drupal_goto to change the theme using the referer theme module above, but that's just a quick idea.

If

aterink - June 20, 2007 - 00:36

Here's another article about customizing paths http://drupal.org/node/104316

thanks

webengr - June 20, 2007 - 12:54

thanks for the good suggestions, I love the way drupal is growing, but it does get more difficult to know about all the possible modules.

IN answer to my question, http://drupal.org/node/104316 seemed like the direct way to do what I asked.
I thought I could create a custom template, by just copying an existing template, set it to default, THEN, add some template pages like page-dayspa.tpl.php and page-poolsupplies.tpl.php
and anything down those paths would use a different template for those pages..... under foomall
but then I read:

"Remember that these template suggestions are based on the default drupal path for a particular page. If you've used the path or pathauto module to hide them with url aliases, these templates will still be searched based on the original paths."

So it may not be that simple because I was using path...
I should also play with "views" so I can see if that is the direction best for me. Thanks again.

THE ANSWER

webengr - June 21, 2007 - 15:14

THE ANSWER

Taxonomy THEME
with "Extended" selected.

UNDER "Taxonomy Theme"

Enable 'Extended' (path-based) assignment of themes
Enables you to assign themes to paths (e.g. node/21) and path aliases.

So for my foomall/poolsupplies I could enter
pool*
in the EXTENEDED tab under the the theme bluemarine and anything under
that path will have the bluemarine theme.

NOTE, if you select "Allow all themes"
and enter a path under "Extended(Paths)"
but the theme you selected was not checked
in allowed thems under site building/thmes
then the blocks don't show and other things are off....

THANKS ALL.

Taxonomy Theme

Rob Loach - July 30, 2007 - 17:49

The Taxonomy Theme module did it. Thanks a lot, webengr.

DRUPAL 6 -- theme change modules may not be mature

webengr - September 29, 2009 - 23:39

Looks Like the above suggested modules for switching/changing theme by path are not stable for drupal6 as of this notation. None of those seem to have recent drupal 6 nor 7 activity.

Taxonomy Theme has 2008-Jun-15 as last devel input for drupal 6.

I found themekey which states alpha available for drupal 6 and it seems more active with a date of 2009-Sep-25,
http://drupal.org/project/themekey

and a related add on,
http://drupal.org/project/themekey_properties

SO hope that helps..

BTW I am guessing many custom themes looks inside themselves perhaps...
If you are making a custom theme, what you might could do is change the page template by
some conditional in your theme, so rather than having a module switch the theme, have the theme
output differently based upon conditionals?

 
 

Drupal is a registered trademark of Dries Buytaert.