Forum Moderators: coopster

Message Too Old, No Replies

PHP include questions

php include server scripting

         

asinah

3:29 pm on Jan 3, 2004 (gmt 0)

10+ Year Member



First of all to everyone happy new year to everyone at webmasterworld.

I have a questions:

I run a website and want to use a php template that would be served by the name of the host name.

Example:
usa.domain.com should serve the template usa.php &
england.domain.com should serve the template england.php &
etc.

I am only able to currently load one template at
< include("/var/www/templates/domain.php"); >

So, if a user would visit [usa.domain.com...] it should show news etc. about the US and not the page that is currently at [domain.com...]

Can someone explain how I can do that, or point me to a website.

bobbee

5:27 pm on Jan 3, 2004 (gmt 0)

10+ Year Member



Wouldn't this work?:

if($domain == 'usa.domain.com'){
include("/var/www/templates/usa.incl.php");
}elseif($domain == 'england.domain.com'){
include("/var/www/templates/england.incl.php");
}

asinah

5:46 am on Jan 4, 2004 (gmt 0)

10+ Year Member



Thanks for replying but some how it is not working.

It looks to me that $domain is ignored..

jamesa

11:45 am on Jan 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of $domain use $_SERVER["HTTP_HOST"]

Also see this in the manual [php.net]

asinah

12:23 pm on Jan 4, 2004 (gmt 0)

10+ Year Member



Thanks so much to both of you. It works now.

Regards,
Asinah