RE: [PHP] include path

From: Date: Wed, 29 Nov 2000 18:24:33 +0000
Subject: RE: [PHP] include path
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27854@lists.php.net to get a copy of this message
Hello everyone, New user here, used to ASP. Is there a way to set a virtual path to include a file so you don't have to mess with the ../../ stuff? If including the same file under different directories do you have to edit each one or is there a virtual option? David Smith -----Original Message----- From: Dan Lowe [mailto:dan@tangledhelix.com] Sent: Wednesday, November 29, 2000 1:17 PM To: Daniel Convissor Cc: PHP List Subject: Re: [PHP] include path There's a problem with that though - if you have /a/subdir/file.php and it contains: include('../main.php'); That works fine to include main.php. But if main.php contains: include('another_file.php'); Then it can't find "another_file.php" to include. It lives in /a but your script is really looking in /a/subdir so it can't find it. -dan Previously, Daniel Convissor said: > Hi Thomas: > > > How to set my own include path without editing php.ini?? > > The include_path doesn't need to be set in your php.ini. What may be > tripping you up is trying to include files from the wrong directories. Note, > all directory requests are relative to the INITIAL PHP script called. So, > you'll have to call things like this: > > -------------- > <?php > # This file is /htdocs/someone/subdir/home.php > include("../head.inc"); > echo "That's it"; > ?> -- Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/ #!/usr/bin/perl -iake_one_down_pass_it_around:_bottles_of_beer:_on_the_wall: 99 for(($t,$a,$b,$i)=split/:/,$^I;$i;print){$_="-$i$a$b,-$i$a,-T$t,-".--$i."$a$ b ";s/(-1_.*?e)s/$1/g;y/_-/ \n/}# by Randolph Chung and Joey Hess -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#27854) next »