开发者

assign drupal theme programmatically

I know that we can assign a theme named page-name.tpl.php to a page called /page/ with the use开发者_JAVA技巧 of the theme engine.

How can i assign a theme to a template programmatically in drupal ?


global $custom_theme;
$custom_theme = 'garland';
init_theme();


Maybe you can use Sections module?

c/p from project page:

This module allows you to create sections within your site. Each section has an installed template, theme or style attached to it.

Sections are shown based on:

  • Node specific visibility settings
  • Role specific visibility settings
  • Page specific visibility settings (regexped paths)
  • Custom PHP visibility snippets


You can use the global $custom_theme variable to change the theme.

http://api.drupal.org/api/drupal/developer--globals.php/global/custom_theme/6

global $custom_theme;
$custom_theme = 'garland';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜