O'Reilly logo

Programming ColdFusion by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required