53764_ColdFusion Custom Tags

Expand / Collapse

What are ColdFusion custom tags?

ColdFusion custom tags are user created custom code that can be referenced similarly to built-in ColdFusion tags throughout your application or server.


How to configure/use Custom Tags

There are 3 scopes for using ColdFusion custom tags.  Depending on your particular usage, one method may make more sense than the others.

Within A Folder - You can locally define custom tags within the folder you wish to call them from.  This method is only useful for custom tags relevant to only one portion of a site.  To use:

  1. Create the custom tag page within the folder you wish to use it.  Example:  tagname.cfm
  2. Call the tag from any other page within that same folder by calling:

Within A Site - The CFModule method allows you to store your custom tag(s) in one location within your site and call the tag from wherever within your application.  To use:

  1. Create the custom tag page within any folder in your site.  You may even consider creating a specific folder from which to reference all your sites' custom tags in order to make development easier.  Example:  /full/path/to/tag/tagname.cfm
  2. Call the tag from any other page on your site by calling:
    <cfmodule template="/full/path/to/tag/tagname.cfm" variablename="variable">

Globally - There are some situations where it makes sense to have a custom tag available universally across all your sites.  As long as you do not require specific variations per site, you can upload the custom tag file to the default custom tags folder on the server or you can define additional custom tags folders within your ColdFusion Administrator under:  Extensions -> Custom Tag Paths

To use:

  1. Create the custom tag page within one of the custom tag folders defined within your ColdFusion Administrator.
  2. Call the tag from any site on your server by calling:

Rate this Article:

Category: ColdFusion

Last Modified:Tuesday, November 20, 2012 1:33 PM

Article not rated yet.

Article has been viewed 5,531 times.

Email Article Email Article

Social Bookmarks Social Bookmarks