Chapter 7: Reusing Code
<CFELSE>
</CFIF>
</CFIF>
Passing Custom Tag Arguments via CFML Structures
Attributes can be passed to custom tags via the reserved attribute
ATTRIBUTECOLLECTION. ATTRIBUTECOLLECTION must reference a structure.
Syntax
CFMODULE
<CFMODULE TEMPLATE=template
Shorthand
<CF_MYCUSTOMTAG OTHERATTR1= value
The key/value pairs contained within the structure specified by
ATTRIBUTECOLLECTION will be copied into the ATTRIBUTES scope. This has
essentially the same effect as specifying these attributes in the custom tag's attribute
list.
ATTRIBUTECOLLECTION may be freely mixed with other attributes within the custom
tag's attribute list.
The reserved attribute name ATTRIBUTECOLLECTION
Custom tag processing reserves ATTRIBUTECOLLECTION to refer to the structure
holding a collection of custom tag attributes. If ATTRIBUTECOLLECTION does not
refer to such a collection, the custom tag processor will raise a TEMPLATE exception.
A custom tag invoked by the two examples above may refer to #attributes.x# and
#attributes.y# to access the attributes passed via structure.
If the called custom tag uses a CFASSOCIATE tag to save its attributes in the base tag,
the attributes passed via structure will be saved as independent attribute values, with
no indication that they were aggregated into a structure by the custom tag's caller.
<!--- Say you are lonely --->
I'm not nested inside any custom tags. :^( <P>
OTHERATTR1=value
ATTRIBUTECOLLECTION=structure
OTHERATTR2=value>
ATTRIBUTECOLLECTION= structure
OTHERATTR2= value >
81
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?
Questions and answers