Managing custom tags
181
Custom tag processing reserves the
attributecollection
attribute to refer to the structure
holding a collection of custom tag attributes. If
attributecollection
does not refer to such a
collection, ColdFusion generates a template exception.
The following example uses an
attributecollection
attribute to pass two of four attributes:
<cfset zort=StructNew()>
<cfset zort.x = "-X-">
<cfset zort.y = "-Y-">
<cf_testtwo a="blab" attributecollection=#zort# foo="16">
If testtwo.cfm contains the following code:
---custom tag ---<br>
<cfoutput>#attributes.a# #attributes.x# #attributes.y#
#attributes.foo#</cfoutput><br>
--- end custom tag ---
its output is the following statement:
---custom tag ---
blab -X- -Y- 16
--- end custom tag ---
One use for
attributecollection
is to pass the entire Attributes scope of one custom tag to
another. This often happens when you have one custom tag that calls a second custom tag and
you want to pass all attributes from the first tag to the second.
For example, you call a custom tag with the following code:
<cf_first attr1="foo" attr2="bar">
To pass all the attributes of the first custom tag to the second, you include the following statement
in first.cfm:
<cf_second attributecollection="#attributes#">
Within the body of second.cfm, you reference the parameters passed to it as follows:
<cfoutput>#attributes.attr1#</cfoutput>
<cfoutput>#attributes.attr2#</cfoutput>
Managing custom tags
If you deploy custom tags in a multideveloper environment or distribute your tags publicly, you
can use the following additional ColdFusion capabilities:
•
Advanced security
•
Template encoding
Securing custom tags
The ColdFusion security framework enables you to selectively restrict access to individual tags or
to tag directories. This can be an important safeguard in team development. For more
information, see
Chapter 16, “Securing Applications,” on page 345
.
Encoding custom tags
You can use the command-line utility
cfencode
to encode any ColdFusion application page. By
default, the utility is installed in the
cf_root
/bin directory. It is especially useful for securing
custom tag code before distributing it.
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......