Get path to *included file* ?
Posted: Tue May 09, 2006 8:27 am
Hi,
Okie dokie! getcwd() gets me the current directory of a script. Great.
Now, what if that script was included by another script? It then gets the directory which the parent script is in right? (or does it? Hmm maybe I should check before posting
).
My question is: How can I have an included file independently determine where it was inlcuded from?
i.e.
files:
Now if ./foo/parent.php include()'s ./foo/bar/included_file.php, included_file.php will report that it's in ./foo not ./foo/bar . Does anybody have a clue what I'm rambling on about? 
Okie dokie! getcwd() gets me the current directory of a script. Great.
Now, what if that script was included by another script? It then gets the directory which the parent script is in right? (or does it? Hmm maybe I should check before posting
My question is: How can I have an included file independently determine where it was inlcuded from?
i.e.
files:
Code: Select all
./foo/
parent.php
bar/
./foo/bar/
included_file.php