I am working out the path to an app, in a config file, and, I need a halfway house between two solutions, which I can't find (or can't think of ).
First of all, I started off with this:
This was OK, and did the job for the PHP files, but gave me a long string like /home/adamc/public_html/path/to/my/file
$path = dirname(__FILE__);
I then went and tried this:
which only returned /path/to/my/file
$path = dirname($_SERVER['SCRIPT_NAME']);
I thuoght great, but then realized something. One of the reasons I need these paths is that I use URL rewriting, and the end user can bury this app down as many directory's as they want! So, My final example would even return my re-written path, which defeated the object! I need something that will work in HTML links, that stays as the root folder of my application (which $_SERVER['SCRIPT_NAME']) would do, except, as the file needs to be included, it changes to reflect that of the file that's called it! So, is there a way to leave this value in concerete, so it can't change, or is there a function etc. I am missing?