Here is the problem:
Suppose I have a php page "test.php" in root folder of my website and in this page I have paths to my images, CSS, javascripts relatively addresed with constants "IMAGES_DIR", "CSS_DIR"... in front of image name...
Example:
<img src="<?php echo IMAGES_DIR;?>blank.gif" border="0">
Every page of my website includes "common/common.php" where are defined "IMAGES_DIR", "CSS_DIR", "SCRIPT_DIR"...
I want now, when I move this "test.php" to any subfolder of my website, to work correctly (as before) so I need only one little upgrade to add to "common/common.php". In front of "IMAGES_DIR", "CSS_DIR" I will add one more constant that is path to my website root and I will named it ROOT and then it will work everywhere in my website (displayed correctly).
I need to have this ROOT constant visible at every page so when I include my webpage "common/common.php" this "common.php" should "see" that ROOT constant.
Instead of:
include_once("common/common.php");
I need:
include_once(ROOT."common/common.php");
If ROOT is defined in "common.php" I have a problem - it must be allready visible in it.
Where I should put this variable ROOT and that it is not in SESSION? Can I put it in (or predefine) some PHP always visible variable?
Thanks.