Managing Custom Tags

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:

Resolving file name conflicts

To avoid errors caused by duplicate custom tag file names, use the CFMODULE tag in the calling template. Note that only one of the required attributes can be used in a given instance of the tag.

CFMODULE Attributes 
Attribute Description  
Template Required if the NAME attribute is not used. Specifies a relative path to the cfm file. Same as TEMPLATE attribute in CFINCLUDE. Note that the directory must have a mapping defined in ColdFusion Administrator Example: <CFMODULE TEMPLATE="../MyTag.cfm"> identifies a custom tag file in the parent directory.
Name Required if Template attribute is not used. Use period -separated names to uniquely identify a sub-directory under the Custom Tags root directory. Example: <CFMODULE NAME="Allaire.Alive.GetUserOptions"> identifies the file GetUserOptions.cfm in Custom Tags\Allaire.Alive directory under the ColdFusion root directory.
Attributes Optional. You can list the custom tag's attributes.

Securing Custom Tags

ColdFusion's security framework enables you to selectively restrict access to individual tags or to tag directories. This can be an important safeguard in team development.

To avoid name conflicts, you can register custom tags as a security resource on the ColdFusion Administrator Advanced Security page. See Administering ColdFusion Server for details.

Encoding Custom Tags

You can use the command-line utility cfencode to encode any ColdFusion application template. By default, the utility is installed in the /cfusion/bin directory. It is especially useful for securing custom tag code before distributing it.

cfencode uses the following syntax:

cfencode infile outfile [/r /q] [/h "message"] /v"2"

The following options are supported:

cfencode Command Line Options 
Option Description
input file Name of the file you want to encode. cfencode will not process an encoded file.
output file Path and filename of the output file. Warning: If you don't specify an output file name, a warning message asks if you want to continue, in which case the encoded file will overwrite the source file.
/r Recursive, when used with wildcards, recurses through subdirectories to encode files.
/q Suppresses warning messages.
/h Header, allows custom header to be written to the top of the encoded file(s).
/v Required parameter that allows encoding using a specified version number. Use "1" for pages you want to be able to run on ColdFusion 3.x. Use "2" for pages you want to run strictly on ColdFusion 4.0 and later.

Note While it is possible to encode binary files with cfencode, it is not recommended.