Creating and calling custom tags. You implement a custom tag with a single ColdFusion page. You then call the custom tag from a ColdFusion page by inserting the prefix cf_ before the page's filename. The page that references the custom tag is referred to as the calling page. Extend CFML by creating custom CFML tags that encapsulate common code. Learn all about custom tags and importing tag libraries with this Free Open Source ColdFusion training course, Learn CF in a Week.
The follow article explains how to use ColdFusion custom tags. A custom tag is a series of ColdFusion tags combined into one tag and called in a similar manner to normal ColdFusion tags. For example, you can create a page called konzol.info and then within your code can call this as cf_script. Calling Custom Tags (CFIMPORT) CFImport allows you to import an entire directory of custom tags. Custom tags are executed using defined prefix. Looks for "konzol.info" ColdFusion template in the directory defined by "tablib" attribute. CFImport tag must be in every template that uses imported tags. Building a simple ColdFusion custom tag is as easy as: A simple custom tag. create a file called konzol.info: #DateFormat(Now().
Last week or so a reader asked if I would quickly demonstrate how I use custom tags for layout. This is something I've done for many years now. Now a days it seems like every one talks about CFCs, or UDFs, and almost no one talks about custom tags. While they are a bit slower than. ColdFusion custom tags built in CFML allow for rapid application development and code reuse while offering off-the-shelf solutions to many programming chores. If you deploy custom tags in a multi-developer environment or distribute your tags publicly, you may want to make use of additional ColdFusion capabilities.