This is a discussion on Newbie Question within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi everyone, I have a technical question which I hope you can help me with. Basically I'm developing a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi everyone,
I have a technical question which I hope you can help me with. Basically I'm developing a site and have decided that using Dreamweaver's Templates is a pain in the arse and I'm using an 'Include' instead which works like a charm. However, it works fine on my testing server, but not on the remote server as the Include comes up with an error if I try Include without a full URL. I've managed to get it to work by using Include ('http:\\www.myurllocation.com\thefilename.txt'); But it's really annoying to have to change the header and footer of each ..php file before I upload them. Is there a way of using PHP to detect if it's on the testing server or remote server ? Basically I'd like something like this If Server=Local { Include ('file.txt'); } Else { Include ('http:\\www.mysiteurl.com\file.txt'); } EndIf Can anyone help ? Thanks in advance. |
|
|||
|
Stupid me...
Just did a PHPINFO(); and looked at the system variables produced... Came up with this: <?php if ($_SERVER['SERVER_NAME']!='localhost') { $Location='Remote'; } else { $Location='Testing'; } Echo"$Location"; ?> Which seems to work.. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|