[development] Accommodating a second base_url

Jamie Holly hovercrafter at earthlink.net
Thu Oct 29 23:46:40 UTC 2009


Using variable_set is trouble waiting to happen. It opens you up to a 
race condition:

User 1 hits site 1 at 7:11:01.05 - hits init and sets the variable which 
is written to the database. Processing continues
User 2 hits site 2 at 7:11:01:15 - hits init and sets the variable which 
is written to the database. Processing continues
User 1 hits the theme engine at 7:11:01:20 - Now the variable has been 
set to site 2 by User 2, so they get the wrong banner.

Since your just changing the header and nothing else, I would do it all 
in the page.tpl.php file just checking the $_SERVER['HTTP_HOST']. No 
need to mess with settings.php or a module. One file and it could be 
done in a single line from my example before (and even handle www. 
problems):

<div id="banner" style="background-image:url(images/<?php echo ( 
strstr($_SERVER['HTTP_HOST'],'example.com'))?'site1header.jpg':'site2header.jpg'; ?>)">




Jamie Holly
http://www.intoxination.net 
http://www.hollyit.net



Jeff Greenberg wrote:
> Laura wrote:
> > What if you simply created different folders in /sites and using 
> > specific themes for each one, each with its own particular banner? At 
> > first blush, this would seem to do the trick, yes?
> >
> > Laura
> Hi Laura,
> It's one banner used throughout, so setting a variable accordingly will 
> do the job.
> Jeff
>
>   


More information about the development mailing list