Depending on the server setup you could just use $_SERVER['HTTP_HOST']
to figure out your $base_url. You can even do it in settings.php. It
does depend on if your sites use www. or not, or even allows both www.
and not. You could use a little PHP logic in settings.php to figure out
exactly what the HTTP_HOST should be (stripos, strstr, switch case, etc)
and then define a constant for it (say CURRENT_SITE), then in your
page.tpl.php file a little PHP magic:
<duv id="banner" style="background-image:url(images/<?php echo (
CURRENT_SITE=='example.com')?'site1header.jpg':'site2header.jpg'; ?>)">
That way CURRENT_SITE wouldn't matter if you have www.example.com or
example.com. Of course you would set your base_url off of which ever
they are coming from.
That would work for most server setups (I've been doing something
similar on a pretty big site for over a year now). The only real time
you run into problems is on some proxy front ends.
Jamie Holly
http://www.intoxination.net
http://www.hollyit.net
Jeff Greenberg wrote:
I'm working on a site that can be invoked via two different url's
(mapped to the same directory). The requested url will dictate what top
banner the site uses. Also, because there are likely many places in the
site that $base_url is used, and the url appearing throughout the
session should be that which was initially used, I will need to alter
$base_url.
So, I'm thinking I should just hook_init, and based on the http request,
alter $base_url if needed, and do a variable_set that I later retrieve
in the theme to alter (or not) the background-image used as the top
banner. Is this the best approach?
Jeff