note 42510 deleted from function.get-included-files by nlopess

From: Date: Wed, 19 May 2004 15:32:44 +0000
Subject: note 42510 deleted from function.get-included-files by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-69831@lists.php.net to get a copy of this message
Note Submitter: flany@artsonik.com ---- 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

« previous php.notes (#69831) next »