Forum Moderators: phranque

Message Too Old, No Replies

Creating Virtual Directories

         

graywolf

5:05 pm on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm changing from ASP to PHP and trying to figure out how to set up virtual directories for include files. The include files will all be in a directory named /includes/ in the root folder the others will look like this

/directory1/
/directory2/
/directory2/subdir1/
/directory2/subdir2/
/directory2/subdir2/subsub1/
/directory2/subdir2/subsub2/
/directory3/

I want to put an include virtual directory inside each of the subdirectories to the include directory at the top level. It's on an apache server with CPanel (don't know if that helps).

ukgimp

5:29 pm on Nov 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does this help?

Put it in each file you create or have a absolute path to it in some sort of function

$root = $_SERVER['DOCUMENT_ROOT'];
$path = "$root$dir";
$dir = "";
include("$path/includes/yourfile.php");

you can then add a directory if you want if you are developing locally.