If the includes are within the website, using
$_SERVER[DOCUMENT_ROOT]/pathtofile/file is a good way to go.

-----Original Message-----
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 29, 2003 2:10 PM
To: 'Greg Macek'; [EMAIL PROTECTED]
Subject: RE: [PHP] require/include from a different directory


> > try using an absolute path.
>
> I've considered that route, but an issue I have with that is I do most
> of my development work on a machine that a different directory
structure
> than the production server (currently a Cobalt RaQ4), so the paths are
> different. Accommodating both would be a time consuming project for
me.

I always put it into a variable.

$_CONF['path'] = '/home/web/www/';

and then use that variable in all of your includes or requires. I also
make an HTML variable that's used in all links and images.

$_CONF['html'] = 'http://www.mysite.com/';

Sure, you have to get used to using this variable everywhere, but it
makes switching server pretty easy.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to