Click to See Complete Forum and Search --> : including files in different directories


JDM71488
10-07-2003, 11:17 PM
Hello,

What can I use to include a file in the first index folder from a file that is in a series of folders?


<?php
include "/header.html";
?>


I tried this, and it works fine as long as what i am linking to is in the base (index) folder...

Please help...
Thank you!

pyro
10-08-2003, 07:26 AM
A PHP include can take on an absolute (sometimes depending on allow_url_fopen (http://us3.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen)) or relative path, much like you'd link to an image:

If you PHP page is in /php/ and the include is in /php/includes/ you'd do this:

include "includes/file.php";If your PHP is in /required/php/ and the include is in the root directory, then you'd do this:

include "../../file.php";