User Guide

Chapter 1: ColdFusion Tags 141
Likewise, if the custom tag uses a CFASSOCIATE tag to save its attributes, the attributes
passed with ATTRIBUTECOLLECTION are saved as independent attribute values with
no indication that the attributes are grouped into a structure by the custom tags caller.
Example <!--- This example shows the use of CFMODULE --->
<HTML>
<HEAD>
<TITLE>CFMODULE Example</TITLE>
</HEAD>
<BODY>
<H3>CFMODULE Example</H3>
<P>
This example shows the use of CFMODULE to call a sample custom
tag inline.
</P>
<P>
This example makes use of a sample custom tag that has been saved in the
file myTag.cfm in the snippets directory. You can also save ColdFusion
custom tags in the Cfusion\CustomTags directory. For more information
about using Custom Tags, please refer to
<i>Developing Web Applications</i>.
</P>
<!--- show the code in the custom tag--->
<P>Here is the code in the custom tag.</P>
<CFOUTPUT>#HTMLCodeFormat("<CFSET X = attributes.x>
<CFSET Y = attributes.y>
<CFSET A = attributes.value1>
<CFSET B = attributes.value2>
<CFSET C = attributes.value3>
<CFSET caller.result = x + y + a + b + c>")#
</CFOUTPUT>
<!--- end sample tag --->
<CFSET attrCollection1 = StructNew()>
<CFSET attrCollection1.value1 = 22>
<CFSET attrCollection1.value2 = 45>
<CFSET attrCollection1.value3 = 88>
<!--- Call the tag with CFMODULE with Name--->
<CFMODULE
Template="..\snippets\myTag.cfm"
X="3"
attributeCollection=#attrCollection1#
Y="4">
<!--- show the code --->
<P>Here is one way in which to invoke the custom tag,
using the TEMPLATE attribute.</P>
<CFOUTPUT>#HTMLCodeFormat("<CFMODULE
Template=""..\snippets\myTag.cfm""
X=3