Aug 05

Call custom tags without cf_ or cfmodule

Posted by James Netherton | Tuesday 05 August 2008 8:08 AM | In ColdFusion

This may be common knowledge but I just stumbled upon it…..

The standard convention for invoking ColdFusion custom tags is to use:

<cf_mytag/>

or

<cfmodule template="mytag.cfm"/>

There’s a way in which you are able to dispense with cf_ prefix and the <cfmodule> call. Browse to your ColdFusion WEB-INF\cftags directory. You should see some files relating to ColdFusion tags such as <cfdump> and <cfsavecontent>. You can add your own custom tag to this directory and invoke it from any CF template. For example:

Custom Tag – mytag.cfm

<cfdump var="#attributes#"/>

Calling Template

<cfmytag attribute1="test1" attribute2="test2"/>

Note that the cf_ or <cfmodule> prefix wasn’t used. Instead the tag call looks like any normal ColdFusion tag invocation.

I doubt this has any real world usage but I thought it was worth blogging anyway.