Solved

Last Modified

Posted on 2003-11-21
3
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

623 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