Solved

Last Modified

Posted on 2003-11-21
3
241 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

18 Experts available now in Live!

Get 1:1 Help Now