Hi,
I have a structure like this:
top_level.php includes 1st_level.php includes 2nd_level.php
top_level.php also includes constants.php before it includes 1st_level.php.
I have parameterised the paths to the files in the includes like this: URLBASE . "includes/1st_level.php". URLBASE is defined as the site name i.e. "http://mysite.com/".
When I do it like this, 1st_level.php recognises and uses the constants perfectly, but 2nd_level.php refuses to recognise any of them.
However, when URLBASE is a relative url e.g. "../", the constants seem to work.
I am now trying to include a menu module (that will be the equivalent of 1st_level.php) that will be used in many places and it won't know where it has been called from i.e. it won't know what level of the site the page that has called it is on, so it won't know whether to use ../ or ../../ etc.
To solve that little dilemma, it uses the full site address for any includes it uses, hence the present constants problem.
So my question is: Can anyone tell me of a way to get PHP to recognise constants in included files more than 1 level deep?
Thanks.
Debbie-Leigh