• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP Include - Call from root directory??


New Member
I have different directories and they all use the same PHP Include files...
Right now, I have to put my Include files in all directories in order for a page within that directory to be able to "call" from it.
I tried calling the include files from a different directory, say I have a directory called "sitestuff" and in the index.php I put
<? include("/includes/nav.php") ?>
where /includes is a different directory that's NOT within "sitestuff" directory, but rather within the root directory. I save it and open it and I get an error page that says something about /include not being in /sitestuff.

Is there anyway to fix this?
So, if I understand correctly, your directory looks like this:


In that case, try this in index.php:

<? include("../includes/nav.php") ?>

These two dots are telling PHP, that it should go back one folder, and search for /includes/nav.php.