I'm trying to figure out how to get my php includes to work properly from files in different directories.
For example, I have a header.php
for my layout which is included in the index.php
- it's located in the root/
directory. Then, I have a page located at root/pages/etc/lib.php
- It also needs to use the header.php
. Now, obviously I could do a include "header.php"
for the index and a include "../../header.php"
for the lib.php
file, but then I run into another issue...
My header.php
also has a php include of it's own, and the relative path is relative to the original page (index.php
or lib.php
) and NOT the header.php
.
Is the solution to simply give the full URL for the includes or is there another way to do this? Can I do URL for any included php files and it will work?