Drupal 7 开发内部培训资料, 分头诗人

使用hook_custom_theme实现根据不同的条件显示不同的主题

可以根据不同的条件显示不同的主题。比如根据用户的角色的不同,ip地址的不同。

自定义一个模块,实现hook_custom_theme

function YOURMODULE_custom_theme() {
  if (ip_address() == '192.168.5.212') {
    return 'THEME_NAME';
  }
}

或者可以使用views的vid 做不同主题,也可以根据角色的不同而改变主题,还有很多很多需要自己慢慢摸索。。。非常强大好用的模块。赶紧试一下。">ThemeKey,ThemeKey Properties模块实现

Drupal 页面请求的处理过程

1. Someone fires a request to your webserver. They might get a cookie if they've already logged into the site.
2. The server gets the request. It goes to .htaccess which says everything should go to index.php
3. index.php loads the APIs and gets them ready to handle the request
4. The Menu API which was loaded looks up the paths that different modules have registered that they handle.
5. The module gets the request and fires hooks to see whether any module wants to help while it's building the page.
6. The module returns some info back to the menu system.
7. If the everything looks good, it figures out which theme is active and hands off the raw data to the theme layer.
8. That gets kicked back to Drupal.
9. That gets kicked back to the web server, which kicks it back to the user.

订阅 RSS - loveye007的博客