开发者

Drupal 6/Pressflow - assign theme based on domain alias

I know modules like Mobile Tools can do what I want - but they don't work with Pressflow or Varnish.

So, what I'm hoping to do is assign开发者_JAVA技巧 the sitewide theme based on the url used to access it. For instance:

example.com <-- This gets the standard, desktop theme

m.example.com <-- This gets the cool shiny iphone-optimized theme with flashy javascript etc

I dont' want multisite because the content is the same.

I don't want a new entry in domain access because the content is already written and it would (presumably) be a huge hassle to go back and assign it all to the new domain.

There's a Domain Context plugin for context, but it says it loads too late in the flow to be able to change the theme.


http://drupal.org/project/themekey with http://drupal.org/project/themekey_properties gives you the option to switch theme based on system:server_name


We ended up solving it with the recommendation from this thread: http://drupal.org/node/984128#comment-3766156

if (isset($_SERVER['HTTP_HOST'])) {
   if (stristr($_SERVER['HTTP_HOST'],"stage")) {
                $GLOBALS['custom_theme'] = 'bar_stage';
    } 
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜