Depiction- Webmaster Resources
Stock Image


Contributors: Advertise Here  |  Advertise Here  |  Advertise Here


Misc Links: Submit Tutorials (Earn $$) l Advertising l Privacy Policy | Site Map

Tutorials > PHP > Last Modified

 

Learn how to display the date and time when a page was last updated.


Letting visitors know the last time a page was updated is really easy to do in PHP.


First of all, place the following anywhere in your .php page where you would like it to appear.

<?
//where the main page you want to display for modification
$last_modified = filemtime("thepageyouwant.php");
//print it all out
print("Page Last Edited");
print(date("m/j/y h:i", $last_modified));
?>


What does all this mean?

$last_modified = filemtime("page.php");- this tells the browser what page you want to monitor or show when changes were last made to it. (Replace "page.php" to the page you add the code to.)

//print it all out print("Page Last Edited");- tells the browser what to place in front of the date. (You may change "Page Last Edited" to whatever you'd like.)

print(date("m/j/y h:i", $last_modified));- prints or displays the date for which the page was last modified.


That's it, your done!

Here is it in action:

This page was last updated on 05/12/11 11:37

 

 


 
 

Affiliates

BioRust Photoshop Tutorials
Tutorial Man Wallpaper Stock  More

Resources