cfmoduleDescription
Invokes a custom tag for use in ColdFusion application pages. The
Use the CategoryWeb application framework tags Syntax<cfmodule template = "template" name = "tag_name" attributeCollection = "collection_structure" attribute_name1 = "value" attribute_name2 = "value" ...> See also
cfapplication AttributesUsage
You can use
Within the custom tag code, the attributes passed with
Likewise, if the custom tag uses a 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
attributeCollection = ##attrcollection1##
y = 4>")#
</cfoutput>
<p>The result: <cfoutput>#result#</cfoutput> </p>
<!--- Call the tag with cfmodule with Name--->
<cfmodule
name = "myTag"
x = "3"
attributeCollection = #attrcollection1#
y = "4">
<!--- show the code --->
<p>Here is another way to invoke the custom tag,
using the name attribute.</p>
<cfoutput>#HTMLCodeFormat( "<cfmodule
name = 'mytag'
x = 3
attributeCollection = ##attrcollection1##
y = 4>")#
</cfoutput>
<p>The result: <cfoutput>#result#</cfoutput>
<!--- Call the tag using the short cut notation --->
<cf_mytag
x = "3"
attributeCollection = #attrcollection1#
y = "4">
<!--- show the code --->
<p>Here is the short cut to invoking the same tag.</p>
<cfoutput>#HTMLCodeFormat( "<cf_mytag
x = 3
attributeCollection = ##attrcollection1##
y = 4>")#
</cfoutput>
<p>The result: <cfoutput>#result#</cfoutput></p>
</body>
</html>
|