note 42510 added to function.get-included-files
| From: | flany at artsonik dot com | Date: | Wed, 19 May 2004 12:18:10 +0000 |
| Subject: | note 42510 added to function.get-included-files | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69824@lists.php.net to get a copy of this message | ||
Sorry a mistake in my first post.
This is a trick to get the name of the parent file (and directory) where "include"
function are used :
## On Linux
$Parent_File = array_shift(array_reverse (explode("/", array_shift(get_included_files())),
TRUE));
$Parent_Directory = array_shift(array_reverse (explode("/",
dirname(array_shift(get_included_files()))), TRUE));
## On Windows
$Parent_File = array_shift(array_reverse (explode("\\",
array_shift(get_included_files())), TRUE));
$Parent_Directory = array_shift(array_reverse (explode("\\",
dirname(array_shift(get_included_files()))), TRUE));
echo "dossier du fichier parent ".$Parent_Directory."
fichier parent ".$Parent_File."\n";
I hope it's useful for people...
Flany
----
Manual Page -- http://www.php.net/manual/en/function.get-included-files.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42510
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42510&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42510&report=yes
Search -- http://master.php.net/manage/user-notes.php