I spent whole page trying to explain it to hash
Then you came in, and said:
Using dirname(FILE) is much nicer in my opinion.
But you failed to provide a code that utilizes this language construct in this topic's context.
Okay, I'll try once more.
I hope we all going to agree that use of absolute path is very handy.
Because one can use the same piece of code, no matter where it called.
For the virtual server it's just full path from the virtual server root.
As I can see, we all share same opinion: using absolute path for the virtual server is very good.
Say we have 2 pages,
also we have a picture,
and if we use absolute path to address this picture, like this:
it work like a charm in both long.php and short.php
because the path is absolute.
And we all agree it is good. (I hope)
Now we move to the filesystem. Here is our apple of discord.
I assume, one may want to have the same "master key", same magic wand as we have in the virtual server. Same absolute path thing, which give us one piece of code to be used everywhere. No matter where it called and where it moved afterwards.
The thing the OP, I hope, were asking for.
Same old 2 pages,
but now we want to include a file, say
Here is the problem:
What code we have to use in both long.php and short.php to include /includes/page.php?
How can we utilize absolute path thing in this case?
Is there a universal code to include your global config.php?
Is this explanation exact enough?