Advanced Techniques
There are several advanced features of the custom tag framework you can use to greatly expand the power of custom tags. You can:
Use two new methods to call custom tags
Pass multiple attributes to a custom tag via a single attribute
Create tag pairs
Create a framework for creating nested tags
Devise a method to halt the processing of custom tags without halting the processing of the calling template
This section covers each advanced technique and gives examples of how you can use them to extend the power of your ColdFusion applications.
Calling Custom Tags Via cfmodule
As I mentioned earlier in the
chapter, the cfmodule
tag provides another way to
invoke custom tags. Using cfmodule
to call your
custom tags allows you to call tags located in directories other than
the \cfusionmx\customtags directory or the
directory the calling template resides in.
cfmodule
also enables you to resolve potential
name conflicts among custom tags by allowing you to reference
different custom tags that might have the same name but reside in
different directories. The syntax for using
cfmodule
follows:
<cfmodule template="template
" name="name
" attributecollection="structure_containing_attributes
" attribute1="value
" attribute2="value
" ... attributen="value
"> [</cfmodule>]
The following attributes are available to the
cfmodule
tag:
-
template
Specifies the path to the ColdFusion template to use as a custom tag. Relative paths are automatically expanded from the current page while absolute ...
Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.