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 a new method 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 we 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 \cfusion\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">
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 paths are expanded ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access