micha <ch*********@web.de> wrote in
news:Xn*************************@204.153.244.170:
suppose i have 3 files:
script.php
somedir/include.php
somedir/config.php
1. script.php includes include.php
2. include.php includes config.php, so the structure looks like a
cascade
now if i include config.php (without path) from include.php the script
tries to include from the directory script.php is in, which makes
sense but is not what i want.
question: how can i find out which dir include.php has been included
from?
micha
thanks for that many responses.
in case somebody is interested, i tested them:
1. $_SERVER['SCRIPT_FILENAME'], $_SERVER['PATH_TRANSLATED'], $_SERVER
['SCRIPT_NAME'] don't work, delivers information about the parent script,
even if the they're called from the included script.
2. __FILE__ works a treat - that's what i'm going to use
3. get_included_files() works equally well, but delivers an array that
i'd have to process.
4. debug_backtrace() does not work. i'd have to call it before file
inclusion, so i doesn't deliver any information about the files
micha
--