Re: non-inheriting includes

From: Date: Wed, 14 Jun 2000 22:10:58 +0000
Subject: Re: non-inheriting includes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1882@lists.php.net to get a copy of this message
Hi Ryan, The __FILE__ constant contains the full path to the file currently being parsed. You could use this in conjunction with the dirname function to ensure that you were including files that were relative to the file that you were currently in. For Example: $inc_path = dirname (__FILE__); include ("$inc_path/filename"); HTH, Zak At 06:06 PM 6/14/00 -0400, Ryan Adams wrote:
Hi all, Does anyone know if there is a method of including files such that when the include is nested it does not inherit the $PHP_SELF of the top document? for instance /test/otherdir/mydoc.php includes ./myfolder/file1 and ./myfolder/file2 Then, /somedir/somefile.php includes /test/otherdir/mydoc.php. Rather than mydoc.php trying to include /somedir/myfolder/file1 and /somedir/myfolder/file2, it should include /test/otherdir/myfolder/file1 and /test/otherdir/myfolder/file2. I'm trying to do this without passing around a variables (due to code overhead/management issues) and without using absolute references (due to code portability issues). Anyone? Please? -Ryan *************************** Ryan Adams Online Systems Development The University of Georgia Athens, GA 30602 (706) 583-0344 radams@fcs.uga.edu *************************** -- 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
Zak Greant Creative Director Nucleus Information Service Inc. "I am rather like a mosquito in a nudist camp: I know what I ought to do, but I don't know where to begin." - Stephen Bayne

« previous php.general (#1882) next »