Newbie Question

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 ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-29-2004
GrImBlY
 
Posts: n/a
Default Newbie Question

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.



Reply With Quote
  #2 (permalink)  
Old 08-29-2004
GrImBlY
 
Posts: n/a
Default Re: Newbie Question

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..



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:16 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0