User Guide

Table Of Contents
Creating custom tags 243
To share a custom tag among applications in multiple directories, place it in the
cfusion\CustomTags directory. You can create subdirectories to organize custom tags. ColdFusion
searches recursively for the Custom Tags directory, stepping down through any existing
subdirectories until the custom tag is found.
You might have a situation where you have multiple custom tags with the same name. To
guarantee which tag ColdFusion calls, copy it to the same directory as the calling page. Or, use
the
cfmodule tag with the template attribute to specify the absolute path to the custom tag. For
more information on
cfmodule, see the next section.
Calling custom tags using the cfmodule tag
You can also use the
cfmodule tag to call custom tags if you want to specify the location of the
custom tag page. The
cfmodule tag is useful if you are concerned about possible name conflicts
when invoking a custom tag, or if the application must use a variable to dynamically call a custom
tag at runtime.
You must use either a
template or name attribute in the tag, but you cannot use both. The
following table describes the basic
cfmodule attributes:
For example, the following code specifies to execute the custom tag defined by the mytag.cfm
page in the parent directory of the calling page:
<cfmodule template="../mytag.cfm">
For more information on using the cfmodule tag, see CFML Reference.
Calling custom tags using the cfimport tag
You can use the
cfimport tag to import custom tags from a directory as a tag library. The
following example imports the tags from the directory myCustomTags:
<cfimport prefix="mytags" taglib="myCustomTags">
Attribute Description
template Required if the
name attribute is not used. Same as the template attribute in cfinclude.
This attribute:
Specifies a path relative to the directory of the calling page.
If the path value is prefixed with "/", ColdFusion searches directories explicitly mapped
in the ColdFusion MX Administrator for the included file.
Example:
<cfmodule template="../MyTag.cfm"> identifies a custom tag file in the parent
directory.
name Required if the
template attribute is not used. Use period-separated names to uniquely
identify a subdirectory under the CustomTags root directory.
Example:
<cfmodule name="MyApp.GetUserOptions"> identifies the file
GetUserOptions.cfm in the CustomTags\MyApp directory under the ColdFusion root
directory.
attributes The custom tag's attributes.