Solved

Last Modified

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Redirect website ! 4 54
UPLOAD FILE TO Web API USING POST 5 125
spamming  on Hosted svrs? 6 98
System Analysis 5 62
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 …
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 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