I'm sure there is a very simple answer, but I can't seem to find it documented anywhere. In general, I want to include a file from any sub-directory using the same code (template). Essentially, I thought I could do this:
<? include "/document_header.php" ?>
<? include "/document_footer.php" ?>
and place some content in the middle. It doesn't work... and I don't want to hard-code the path because my development environment (on my machine) is a different platform that the "production" environment (on an ISP).
So, I tried to do this:
<? include $DOCUMENT_ROOT . "/document_header.php" ?>
But it appears that $DOCUMENT_ROOT changes for any location on the site. Literally, the root location of the active file.
Is there a server variable or some syntax that would help me include a file from any point in the Web site that is located at the "root" directory for that site?
I hate to say this, but if this were ASP, then I would just do:
<!--#include virtual="/document_header.asp" -->
Unfortunately, PHP doesn't execute SSI includes... so I want to use the include() function.
Any help would be a w e s o m e !
😃
DCB