Link to home
Start Free TrialLog in
Avatar of bxrunner
bxrunner

asked on

Last Modified

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
ASKER CERTIFIED SOLUTION
Avatar of CFDevHead
CFDevHead

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CFDevHead
CFDevHead

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>
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