recursion is fun!
create and run the following two files for a cool example of recursion :)
text.cfm
---------------------------------------------------
<cf_fileList rootFolder="c:\inetpub\wwwroot">
---------------------------------------------------
fileList.cfm
---------------------------------------------------
<cfdirectory directory="#attributes.rootFolder#" name="contents">
<cfoutput query="contents">
<cfif len(name) GT 2>
<cfif type IS "dir">
<cf_fileList
rootFolder="#attributes.rootFolder#\#name#">
<cfelseif name CONTAINS ".cfm">
<cfset request.files =
listAppend(request.files,name)>
<!--- this code will be run on all files found --->
</cfif>
</cfif>
</cfoutput>
---------------------------------------------------
pretty basic. You'll end up with a list of all files in the original root
folder and all subfolders in (stored in request.files)
You can do other cool things with this kind of recursion (like use it to
build a CFtree).
Bryan Love ACP
[EMAIL PROTECTED]
-----Original Message-----
From: George Dong [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 06, 2001 5:52 PM
To: CF-Talk
Subject: How to make recursion in CF
hi there,
if anyone can tell me how make recursion function in CF template?
thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists