What's the best way to have a different theme for an aliased site: e.g.:
I have foo.com and its alias stage.foo.com.
foo.com uses "baz" as the theme, stage.foo.com should use "baz_stage" as the theme.
As implied, my use case is for internal testing, so I'm happy to rewrite/override the theme variable on every page from a custom module (or settings.php etc).
I tried
if ($_SERVER['HTTP_HOST'] == "stage.foo.com") {
$conf = array('theme_default' => 'baz_stage');
}
in settings.php but this didn't work - presumably because it's getting rewritten later on by domain_conf.
Comments
Comment #1
apemantus commentedJust as more information:
This code:
seems to work for "site 0", but not for any other site.
e.g. site 0 is foobar.com and stage.foobar.com shows the stage theme. However, site 5, which is foo.com doesn't show the stage theme for stage.foo.com.
I've tried altering the weight of Domain Theme in /admin/build/domain/settings but that hasn't made any difference, and I've tried overriding $GLOBALS['conf']['theme_default'] using hook_init.
Is there anything like domain_conf_variable_set which I can call which won't update the database?
Comment #2
apemantus commentedOK, after a bit of rooting around Domain Theme, it looks like it's easiest to override $custom_theme, so now having this in hook_init of my custom module works:
Hopefully this is a problem-free way of doing things.