For each page I am coding I have a foot that I use php include "footer.php" in all of them. Below is the foot.php code. I need my code to be able to give the correct time stamp for each file not one speific file. So in the end each page should have a different time stamp because I am workign on each file at different times becasue the website I am making is for a class assignments. And of course each assignment is being coded at on different days. If this doesn’t make since let me know.
<footer align="center">
<hr width="900px" size="2" noshade="noshade" color="black" align="center">
<div style="padding:0 30px">
<p>Validated by:</p>
<a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88"></a>
<a href="https://jigsaw.w3.org/css-validator/check/referer"><img src="https://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<p>Last modified:
<?php
$timestamp = filemtime(__FILE__);
$date_time = new DateTime();
$date_time->setTimezone(new DateTimeZone("America/New_York"));
$date_time->setTimestamp($timestamp);
echo $date_time->format("F j Y g:i a.");
?>
</p>
</div>
</footer>
I asked for help on this before but not working out.
2
Answers
First we need a function that reads all files of a folder in an association
reads out the timestamp values
and a second function that determines the largest/most recent value
the footer now shows the date of the newest file from the folder
If you want to show the modification time of the file including the footer, then remove
$timestamp = filemtime(__FILE__);
from the footer file and put it before theinclude()
.Eg: