[RESOLVED] Writing "last modified" on my page
Hello
I want to add a "Last Modified..." on my index page. I know how to get the last modified date of an actual file but I would really like to do it with the main folder (www) that all my files are on. Since my index page wont change but the folder always will with new data and such, I would like to do that.
Does anyone know how to display the last modified date of the top most folder? On my server its the www folder. Thank you
Re: Writing "last modified" on my page
Ok, I found it on another site, this is what I am using
Code:
<?php
// This gets the last modified date of the root directory (www)
$filename = $_SERVER[DOCUMENT_ROOT];
if (file_exists($filename)) {
$modDate = date ("F d Y H:i:s.", filemtime($filename));
}
?>
Re: Writing "last modified" on my page
Quote:
Originally Posted by neicedover1982
Ok, I found it on another site, this is what I am using
Code:
<?php
// This gets the last modified date of the root directory (www)
$filename = $_SERVER[DOCUMENT_ROOT];
if (file_exists($filename)) {
$modDate = date ("F d Y H:i:s.", filemtime($filename));
}
?>
Don't you need to add a . after the folder name to make it recognise the folder as a file as per the comment here? I'm shure if you don't it will then return the date of the last modified file in the folder...
Cheers,
Ryan Jones
Re: [RESOLVED] Writing "last modified" on my page
The filename is spitting out "htdocs/kevinmc/www". I want to get the date of the www (this is the directory of all the web files). So far its spitting out the correct date and time. I havent seen anything wrong so far.
Re: [RESOLVED] Writing "last modified" on my page
Quote:
Originally Posted by neicedover1982
The filename is spitting out "htdocs/kevinmc/www". I want to get the date of the www (this is the directory of all the web files). So far its spitting out the correct date and time. I havent seen anything wrong so far.
Maybe it does it automatically in later versions of PHP then :-)
Cheers,
Ryan Jones
Re: [RESOLVED] Writing "last modified" on my page
I added the "." after reading that post. I will make sure to look at the times when I do stuff to see which is the acurate answer.