#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Norway
    Posts
    57
    Rep Power
    13

    How to add "Last updated"???


    Is there any way to add a automatically date/time when a page/script was last updated? The page is not driven on a db.

    Freddy....
  2. #2
  3. No Profile Picture
    Overly white
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Fresno, CA
    Posts
    83
    Rep Power
    12
    http://www.asp101.com/samples/viewas...modified%2Easp

    The only problem with this is that you will need to put this code on every page. If you placed it all in an include file and then had it look up the size of Server.Variable("SCRIPT_NAME") that would return the date of the include file I would think.

    Maybe a better way would be to place it all in a function with a parameter for the page name, then place the function in an include file. Here is my version of the code, I didn't test it sorry. Hopefully it works or if not you can re post and I'll correct my mistakes

    Code:
    Function LastModDate(Page)
    Dim objFSO
    Dim objFile
    Dim dateModified
    
    ' Creates the object and assigns it to our variable.
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    
    ' Get access to the file
    Set objFile = objFSO.GetFile(Server.MapPath(page))
    
    ' Get last modified property
    LastModDate = objFile.DateLastModified
    
    ' Kill our objects
    Set objFile = Nothing
    Set objFSO = Nothing
    
    End Function

IMN logo majestic logo threadwatch logo seochat tools logo