|
-
Apr 19th, 2006, 01:21 PM
#1
Thread Starter
Fanatic Member
[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
-
Apr 19th, 2006, 01:53 PM
#2
Thread Starter
Fanatic Member
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));
}
?>
-
Apr 19th, 2006, 02:04 PM
#3
Re: Writing "last modified" on my page
 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
-
Apr 19th, 2006, 03:23 PM
#4
Thread Starter
Fanatic Member
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.
-
Apr 19th, 2006, 03:26 PM
#5
Re: [RESOLVED] Writing "last modified" on my page
 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
-
Apr 19th, 2006, 03:26 PM
#6
Thread Starter
Fanatic Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|