Include and evaluate another php file relatively
Posted: Fri Aug 12, 2005 11:03 pm
I have a php file, for example that has an image in it. I want to include this file within another page (in another directory etc), but include it as if it were within that directory. include( evaluates it in its own context, then prints the results. This is not what I want. Can anyone help?
I realise this is not very well explained, so i will illustrate an example:
fileA.php is in a dir called dirA/
This file basically gives a directory lisiting of the current dir.
fileB.php is in a dir calle dirB/
I want this file to include fileA.php, but instead of listing the contents of dirA/ (as it does at the moment), I want it to list the contents of dirB/ (the dir where fileB.php is calling it from.
at the moment I'm just using include()
Thanks,
Mitch
I realise this is not very well explained, so i will illustrate an example:
fileA.php is in a dir called dirA/
This file basically gives a directory lisiting of the current dir.
fileB.php is in a dir calle dirB/
I want this file to include fileA.php, but instead of listing the contents of dirA/ (as it does at the moment), I want it to list the contents of dirB/ (the dir where fileB.php is calling it from.
at the moment I'm just using include()
Thanks,
Mitch