Re: Includes and paths problem

From: Date: Fri, 18 Apr 2003 23:11:31 +0000
Subject: Re: Includes and paths problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144447@lists.php.net to get a copy of this message
When you say "absolute" is this absolute to your root directory of your website or your computer. Sorry if this sounds stupid, but I have been struggling with this for some time and want to be sure I'm doing this right. So in your example ($_CONF['path'] = '/home/web/www/site';) - what is this in relation to? Oh, by the way - this is Windows 2000 server using IIS (not my idea). C.R. ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "'C.R.'" <odcs@rogers.com>; "'PHP General'" <php-general@lists.php.net> Sent: Friday, April 18, 2003 6:08 PM Subject: RE: [PHP] Includes and paths problem > > Is their a proper way to include files so that the paths are always > > correct. > > I have a login script as well as protected pages - and the protected > pages > > may be accessed from many possible locations on the site - the > included > > files may also have other included files - so what I have now is a > real > > mess. I'm constantly getting errors saying could not find this file or > > that > > file. Is there a way I can make sure these files are available from > > anywhere. Using an include directory works for some files, but I can't > put > > my whole site in there. > > Use absolute paths. A common method is to define a variable: > > $_CONF['path'] = '/home/web/www/site'; > > And use that in all of your includes. > > Include($_CONF['path'] . '/security/security.php'); > > ---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 > >

« previous php.general (#144447) next »