Solved

Last Modified

Posted on 2003-11-21
3
242 Views
Last Modified: 2013-12-24
Am using coldfusion MX and am very new at it.  Am creating a web page and the user insists on a last date modified on the first page.  I have gone through every book imaginable to no avail.  Can some one please give me the step by step instructions.  


Thank you
0
Comment
Question by:bxrunner
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
CFDevHead earned 500 total points
ID: 9799067
This will give you last date modified  for the current page

<cfdirectory action="list" directory="#GetDirectoryFromPath(GetCurrentTemplatePath())#" name="myDir">
<cfset thisFile=#listlast(GetBaseTemplatePath(),'\')#>
<cfoutput>
<cfloop query="myDir">
      <cfif thisfile is name>
      #name#-#DATELASTMODIFIED#
      </cfif>
</cfloop>
</cfoutput>
0
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9799083
so lets break it down

First we qury the directory to get a list of all the files in that directory
<cfdirectory action="list" directory="#GetDirectoryFromPath(GetCurrentTemplatePath())#" name="myDir">
second we get the name of the current file
<cfset thisFile=#listlast(GetBaseTemplatePath(),'\')#>


<cfoutput>
thrid we loop through the list of files to see if any of match the current page
<cfloop query="myDir">
     <cfif thisfile is name>
     #name#-#DATELASTMODIFIED#
     </cfif>
</cfloop>
</cfoutput>
0
 
LVL 6

Expert Comment

by:PE_CF_DEV
ID: 9799304
That wil work but it is more overhead. Use the filter value in cfdirectory to get just that file name.

<cfdirectory action="list" directory="#GetDirectoryFromPath(GetCurrentTemplatePath())#" name="myDir" filter="#getfilefrompath(GetCurrentTemplatePath())#">
then just output
<cfoutput>#myDir.name#-#myDir.DATELASTMODIFIED#</cfoutput>

This should just return one result which will allow you to get past having to loop through the entire directory.

for more info on <cfdirectory>:

http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-a20.htm
0

Featured Post

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tool to email me when a website changes 29 118
ip / url redirect 13 68
Moving web servers into a DMZ? 3 46
Stream live video from Raspberry Pi camera 22 114
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now