Re: Conditional include based on virtual host ?

From: Date: Sun, 28 Jan 2001 00:36:40 +0000
Subject: Re: Conditional include based on virtual host ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37057@lists.php.net to get a copy of this message
On Fri, 26 Jan 2001 14:52:28 +0100, you wrote: >Hello, > >I have developed a large web application the contents of which (language and >data) depends on the URL the site is accessed from, e.g. en.site.com would >display the "english" site, and "fr.site.com" would display the french site It's a good way to do it, I wrote an extension to FastTemplates (and the phplib templates.inc) to help with such an event so you could have multiple levels of templates, falling back eventually (and hopefully, or it's broken) to a default set. The defaults could be English (and no-language, others could be fr, es, pt, Klingon, whatever. A different name to access the site could look utterly different, just have most of the same content on the page, in different places. I was going to use it to re-skin websites according to who it was for (originally it was going to be a 'virtual bookshop' that companies could brand for themselves). >The whole thing is "parameterized" through a set of global variables (or >defines) that reside in a file called settings.php. The question is: how can >I include the "right" settings.php file, depending on the virtual host used >to access the site? Take a look at the output of phpinfo() for the two virtual sites, especially HTTP_SERVER_VARS["HTTP_HOST"] HTTP_SERVER_VARS["SERVER_NAME"] Server_name is likely to be the 'main name' (www.example.com), but http_host should be the name it's called by (not always the same thing) Alister

« previous php.general (#37057) next »