Chapter 1: ColdFusion Tags
133
DELIMITERS
Optional. Specifies the delimiter characters used to separate items in the LIST.
Example
This loop will display the names of each of the Beatles:
<CFLOOP INDEX="ListElement"
LIST="John,Paul,George,Ringo">
<CFOUTPUT>#ListElement#</CFOUTPUT><BR>
</CFLOOP>
Although CFLOOP expects elements in the list to be separated by commas by default,
you are free to specify your own element boundaries in the DELIMITER attribute.
Here’s the same loop as before, only this time CFLOOP will treat commas, colons, or
slashes as list element delimiters:
<CFLOOP INDEX="ListElement"
LIST="John/Paul,George::Ringo"
DELIMITERS=",:/">
<CFOUTPUT>#ListElement#</CFOUTPUT><BR>
</CFLOOP>
Delimiters need not be specified in any particular order. Note that consecutive
delimiters are treated as a single delimiter; thus the two colons in the previous example
are treated as a single delimiter between "George " and "Ringo. "
Looping over a COM Collection or Structure
The CFLOOP COLLECTION attribute allows you to loop over a structure or a COM/
DCOM collection object:
•
A COM/DCOM collection object is a set of similar items referenced as a group
rather than individually. For example, the group of open documents in an
application is a type of collection.
•
A structure can contain either a related set of items or be used as an associative
array. Looping is particularly useful when using a structure as an associative
array.
Each collection item is referenced in the CFLOOP by the variable name that you supply
in the ITEM attribute. This type of an iteration is generally used to access every object
within a COM/DCOM collection or every element in the structure. The loop is
executed until all objects have been accessed.
The COLLECTION attribute is used with the ITEM attribute in a CFLOOP. In the
example that follows, ITEM is assigned a variable called
file2
, so that with each cycle
in the CFLOOP, each item in the collection is referenced. In the CFOUTPUT section,
the name property of the
file2
item is referenced for display.
Содержание COLDFUSION 4.5-CFML LANGUAGE
Страница 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Страница 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Страница 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Страница 296: ...272 CFMLLanguageReference INPUT TYPE text NAME number2 BR INPUT TYPE submit NAME submit VALUE Add FORM BODY HTML...
Страница 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Страница 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Страница 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Страница 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Страница 557: ...Chapter 2 ColdFusion Functions 533 P CFOUTPUT Value i is employee keysToStruct i CFOUTPUT P CFLOOP CFIF BODY HTML...
Страница 584: ...560 CFMLLanguageReference...
Страница 594: ...570 CFMLLanguageReference...