File Modified Date/Time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

File Modified Date/Time

Post by fractalvibes »

Quick Simple Question:
If I want a little blurb at the bottom of all my pages on a site
Last Modified 07/30/2003
I'd like simply to include a common script to do this for each page.
Looks like the function filemtime($myfile) is what I need. So - two questions:

Is there a simple special value I can pass so the $myfile is always the
page in question? i.e. a special "me" value?

If so, will this get the change date of the page in question, or simply the included file?

many thanks and sorry for such a dumb question!

Phil J.
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post by jmarcv »

#1, consider:
include 'footer.inc';

Where footer is the code to display the modified time.

Second, if it is apache, consider the special $PHP_SELF global variable.
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

Post by fractalvibes »

Thanks - that is what I was looking for.

Will $PHP_SELF resolve to the included file or the file that includes it?

thanks!

Phil J.
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post by jmarcv »

Try it. You will see that it defaults to the 'parent' script, not the include.
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

Post by fractalvibes »

Ok will do - thanks!

Phil J.
Post Reply