Entry
How to get the name of the current PHP file? to print its modification date in a global footer.
Mar 15th, 2008 17:51
ha mo, Crick Dougles, Philip Olson, amal k m, Alex Dean, Kathy Dopp,
To get the the name of the current PHP filename, use the PHP_SELF
predefined variable like so:
echo $_SERVER['PHP_SELF'];
If inside an include (see include()), this will print the parent file
(the file the include is included in) as opposed to the name of the
include file itself. If you want the includes file name, consider:
echo __FILE__;
Where __FILE__ is a predefined constant. It also includes the path so
for just the filename:
echo basename(__FILE__);
But for this question it appears you are using a footer (an include)
and want the modification of the file that it's being included in (the
parent file) so you want to do something like this:
echo date ('F d Y H:i:s', filemtime($_SERVER['PHP_SELF']));
See the manual for details:
http://www.php.net/variables.predefined
http://www.php.net/function.filemtime
http://www.eindianweddingcards.com
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.mozmar.com
http://www.yamot.com
http://www.templatestemp.com