134
CFML Language Reference
Examples
This example employs a COM object to output a list of files. In this example,
FFUNC
is a
collection of
file2
objects.
<CFOBJECT CLASS=FileFunctions.files
NAME=FFunc
ACTION=Create>
<CFSET FFunc.Path = "c:\">
<CFSET FFunc.Mask = "*.*" >
<CFSET FFunc.attributes = 16 >
<CFSET x=FFunc.GetFileList()>
<CFLOOP COLLECTION=#FFUNC# ITEM=file2>
<CFOUTPUT>
#file2.name# <BR>
</CFOUTPUT>
</CFLOOP>
This example loops through a structure (used as an associative array):
...<!--- Create a structure and loop through its contents --->
<CFSET Departments=StructNew()>
<CFSET val=StructInsert(Departments, "John ", "Sales ")>
<CFSET val=StructInsert(Departments, "Tom ", "Finance ")>
<CFSET val=StructInsert(Departments, "Mike ", "Education ")>
<!--- Build a table to display the contents --->
<CFOUTPUT>
<TABLE cellpadding= "2 " cellspacing= "2 ">
<TR>
<TD><B>Employee</B></TD>
<TD><B>Dept.</B></TD>
</TR>
<!--- In CFLOOP, use ITEM to create a variable
called person to hold value of key as loop runs --->
<CFLOOP COLLECTION=#Departments# ITEM= "person ">
<TR>
<TD>#person#</TD>
<TD>#StructFind(Departments, person)#</TD>
</TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>
...
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...