Page 1 of 1
Date Modified
Posted: Fri Dec 25, 2009 5:17 pm
by Vegan
I recall from long ago you could use a Front Page Extension to show the date that the page was last modified. If that possible with PHP to determine this and then "echo" the result as part of a footer document.
Thanks in advance
Re: Date Modified
Posted: Fri Dec 25, 2009 6:00 pm
by Darhazer
If it is a static page, you can use the filemtime function. You can even output a javascript, which renders the document.latModified property.
But if this is a dynamic script, for exampe a database driven application, you have to get the data of last entry in the database and to output it. And it's more important to send it as an HTTP header, then to output it in the footer.
Re: Date Modified
Posted: Fri Dec 25, 2009 6:10 pm
by requinix
By the way, for static pages
Code: Select all
filemtime(__FILE__) // file containing this code
filemtime($_SERVER["SCRIPT_FILENAME"]) // file originally requested
Re: Date Modified
Posted: Sat Dec 26, 2009 4:18 pm
by Vegan
<script type="text/javascript">
// This does not remain a constant with each refresh
var date
date=document.lastModified
document.write("Last Modified on "+date)
</script>
So I need some PHP to replace this, somebody?
The above probably is more suitable to HTML rather than PHP based ones. Have not tried that way.
Re: Date Modified
Posted: Sat Dec 26, 2009 4:24 pm
by Vegan
Found something after sifting through some crud.
Code: Select all
<?php
// outputs e.g. 'Last modified: March 04 1998 20:43:59.'
echo "Last modified: " . date ("F d Y H:i:s.", getlastmod());
?>
This works fine, which is what my goal was.