Results 1 to 6 of 6

Thread: [RESOLVED] Writing "last modified" on my page

  1. #1

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Resolved [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
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  2. #2

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    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));
    	}
    ?>
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  3. #3
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    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
    My Blog.

    Ryan Jones.

  4. #4

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    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.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  5. #5
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    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
    My Blog.

    Ryan Jones.

  6. #6

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    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.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width