RE: [PHP] Require() using relative path

From: Date: Wed, 19 Jul 2000 13:38:10 +0000
Subject: RE: [PHP] Require() using relative path
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7261@lists.php.net to get a copy of this message
> -----Original Message----- > From: Ken M. Mevand [mailto:geekabyte@yahoo.com] > Sent: Wednesday, July 19, 2000 4:37 AM > To: 02 PHP > Subject: [PHP] Require() using relative path > > > here is my file layout : > > index.php > |- templates > | |-default.php > | |-welcome.php > > i called index.php which includes default.php, which in turn includes > welcome.php. can the 2nd include in default.php be done using > require("welcome.php") > > instead of > require("templates/welcome.php") ? Nope (I just tried), because the "current directory" remains the directory of the original script (in this case, index.php). What you *could* do is add the templates directory to your include_path, either in your php.ini, or using a .htaccess file. --- Mark Roedel | "Blessed is he who has learned to laugh Systems Programmer | at himself, for he shall never cease LeTourneau University | to be entertained." Longview, Texas, USA | -- John Powell

« previous php.general (#7261) next »