ColdFusion 9.0 Resources |
Using custom CFML tagsCustom tags written in CFML behave like ColdFusion tags. They can do all of the following:
Although a custom tag and a ColdFusion page that you include using the cfinclude tag are both ColdFusion pages, they differ in how they are processed. When a page calls a custom tag, it hands processing off to the custom tag page and waits until the custom tag page completes. When the custom tag finishes, it returns processing (and possibly data) to the calling page; the calling page can then complete its processing. The following image shows this process. The arrows indicate the flow of ColdFusion processing the pages. Calling custom CFML tagsUnlike built-in tags, you can run custom CFML tags in the following three ways:
To call a CFML custom tag directly, precede the filename with cf_, omit the .cfm extension, and place the name in angle brackets (<>). For example, use the following line to call the custom tag defined by the file mytag.cfm: <cf_myTag> If your tag takes a body, end it with the same tag name preceded with a forward slash (/), as follows: </cf_myTag> For information on using the cfmodule and cfimport tags to call custom CFML tags, see Creating and Using Custom CFML Tags. Recommended usesColdFusion custom tags let you abstract complex code and programming logic into simple units. These tags let you maintain a CFML-like design scheme for your code. You can easily distribute your custom tags and share tags with others. For example, the ColdFusion Developer Exchange includes a library of custom tags that perform a wide variety of often-complex jobs; see www.adobe.com/go/learn_cfu_exchange_en. Consider using CFML custom tags in the following circumstances:
If you can create either a UDF or a custom CFML tag for a purpose, first consider creating a UDF because running it requires less system overhead than using a custom tag. For more informationFor more information on custom CFML tags, see Creating and Using Custom CFML Tags. |