I need to include the same files on every page in all subdirectories. I wish not to use the complete path because I don't want to have to update the include on every page when I upload it to the web.
Any suggestions?
| SitePoint Sponsor |
I need to include the same files on every page in all subdirectories. I wish not to use the complete path because I don't want to have to update the include on every page when I upload it to the web.
Any suggestions?

Just do something like this:
Or What you could do is put the path to your include files in your php.ini file under the include_path varable and then you would just have to do this:PHP Code:require_once('../../includes/includeme.php');
-or-
require_once('../includes/includeme.php');
saying that your include_path variable has your path to your include directory in it.
PHP Code:require_once('includeme.php');
Jon Whitcraft :: It's the Bombdiggity!
Web Applications Developer :: Zend Certified Engineer
http://www.indycar.com
Thank you.
I'm prepending the links with "../" and it seems to be working fine except for the style sheet. I am linking to an external style sheet via the link "../style.css" which is in the main directory. This is contained inside "header.php." It works fine in all of the sub directories but it does not work on the index.php page. I could just copy and past the content of the header into index.php and change the stylesheet link, but I'm sure there's another way.
Bookmarks