[development] $custom_theme when does it take effect... when doesit not

Daniel F. Kudwien news at unleashedmind.com
Thu Aug 14 22:26:15 UTC 2008


> On our website we use different themes for different sections 
> of the site.  As the user browses to different sections of 
> the site, the theme is changed automatically by changing 
> $custom_theme global in hook_init().

If you're doing this in with custom code, you should give
http://drupal.org/project/sections a try.  The module has been thoroughly
tested and works AFAIK.  Similar, but different purpose is
http://drupal.org/project/switchtheme.

> The development question: I think the bug has something to do 
> with the code in the block module function 
> block_admin_display(). In this function the author of the 
> code tries to display a list of blocks for the theme the user 
> selected by changing  the global variable $custom_theme. The 
> problem with this approach is that outside of
> hook_init() I have found that changing $custom_theme variable 
> has no effect on changing the active theme.

You should not try to change the theme on block administration pages.  Above
mentioned modules implement exactly this exception.

Thanks,
Daniel



More information about the development mailing list