Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last Modified Date for Cold Fusion Templates 2

Status
Not open for further replies.

DrmWvr

Programmer
Apr 2, 2002
22
CA
Does anyone know how to code CF so that it will display the last modified date for a .cfm file?

Javascript doesn't work and displays 1969.

I haven't been working with CF long so I'm still working my way up the learning curve. Any help would be greatly appreciated.

thanks,
Marc
Quebec, Canada
 
the following tag will return all the files in the specified directort and store it in the 'myDirectory' variable:

<CFDIRECTORY DIRECTORY=&quot;c:\inetpub\ NAME=&quot;myDirectory&quot;
SORT=&quot;name ASC, size DESC&quot;>

When using the ACTION=LIST, CFDIRECTORY returns five result columns you can reference in your CFOUTPUT:

Name - Directory entry name.
Size - Size of directory entry.
Type - File type: File or Dir for File or Directory.
DateLastModified - Date an entry was last modified.
Attributes - File attributes, if applicable.
Mode - (Solaris and HP-UX only) The octal value representing the permissions setting for the specified directory. For information about octal values, refer to the UNIX man pages for the chmod shell command.

You can use the following result columns in standard CFML expressions, preceding the result column name with the name of the query:

#mydirectory.Name#
#mydirectory.Size#
#mydirectory.Type#
#mydirectory.DateLastModified#
#mydirectory.Attributes#
#mydirectory.Mode#



Sylvano
dsylvano@hotmail.com
 
Try this:

----- Start Code -----

<CFDIRECTORY ACTION=&quot;LIST&quot;
DIRECTORY=&quot;#GetDirectoryFromPath(CF_TEMPLATE_PATH)#&quot;
NAME=&quot;MyPath&quot;
FILTER=&quot;#GetFileFromPath(CF_TEMPLATE_PATH)#&quot;>

<CFOUTPUT query=&quot;MyPath&quot;>#DateFormat (DateLastModified,&quot;MM/DD/YYY&quot;)# #TimeFormat(DateLastModified,&quot;h:mm tt&quot;)#</CFOUTPUT>

----- End Code -----

Name the page LastUpdated and then you can call it as a custom tag in any page like this:

<P>Page last updated: <CF_LastUpdated></P>

Hope this helps.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top