Hi folks,
I would like to switch the style/template/theme however you call it based on the current hostname.
I have here a normal s9y installation and the vhost where it is running has some Aliases.
I would like to have theme a displayed when the blog is called by hostname X and theme b when called by hostname Y..
Is that possible?
Regards,
SirSydom
Switch Style based on hostname?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Switch Style based on hostname?
Hi!
You would need to create a simple event plugin that listens on the frontend_configure hook and sets $serendipity['template'] depending on $_SERVER['HTTP_HOST'].
I think someone already even requested this, so if you dig a lot you might find more on the forum with this, try it with HTTP_HOST and template and frontend_configure?
HTH,
Garvin
You would need to create a simple event plugin that listens on the frontend_configure hook and sets $serendipity['template'] depending on $_SERVER['HTTP_HOST'].
I think someone already even requested this, so if you dig a lot you might find more on the forum with this, try it with HTTP_HOST and template and frontend_configure?
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Switch Style based on hostname?
it doesn't really work..
either
nor
does work. Ends up with a totally messed up screen. It works for some templates, but only some.
The templatechoose plugin has the same error, by the way. It uses the second approach.
either
Code: Select all
$serendipity['template'] = $mytemplate;
Code: Select all
$templateInfo = serendipity_fetchTemplateInfo($mytemplate);
$eventData['template'] = $_SESSION['serendipityUseTemplate'];
$eventData['template_engine'] = isset($templateInfo['engine']) ? $templateInfo['engine'] : $serendipity['defaultTemplate'];
$serendipity['smarty_vars']['head_link_stylesheet'] = $serendipity['baseURL'] . 'serendipity.css.php?switch=' . $mytemplate;
The templatechoose plugin has the same error, by the way. It uses the second approach.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Switch Style based on hostname?
Hi!
What's your full code of your event plugin? Did you properly enable the plugin?
The templatechooser plugin BTW is a good example, it works properly here. Can you show the URL to see what you mean with "messed up"?
Regards
Garvin
What's your full code of your event plugin? Did you properly enable the plugin?
The templatechooser plugin BTW is a good example, it works properly here. Can you show the URL to see what you mean with "messed up"?
Regards
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/