User Guide

Table Of Contents
250 Chapter 11: Creating and Using Custom CFML Tags
Compiling custom tags
You can use the command-line utility
cfcompile to precompile your custom tag files into Java
class files or byte code. For more information, see “Using the cfcompile utility” in Chapter 5,
“Deploying ColdFusion Applications” of Configuring and Administering ColdFusion MX.
Executing custom tags
The following sections provide information about executing custom tags, including information
about handling end tags and processing body text.
Accessing tag instance data
When a custom tag page executes, ColdFusion keeps data related to the tag instance in the
thisTag structure. You can access the thisTag structure from within your custom tag to control
processing of the tag. The behavior is similar to the
File tag-specific variable (sometimes called
the File scope).
ColdFusion generates the variables in the following table and writes them to the
thisTag
structure:
The following example accesses the
ExecutionMode variable of the thisTag structure from
within a custom tag:
<cfif thisTag.ExecutionMode is 'start'>
Handling end tags
The examples of custom tags shown so far in this chapter all reference a custom tag using just a
start tag, as in:
<cf_date>
In this case, ColdFusion calls the custom tag page date.cfm to process the tag.
Variable Description
ExecutionMode
Contains the execution mode of the custom tag. Valid values are "start", "end",
and "inactive".
HasEndTag
Distinguishes between custom tags that are called with and without end tags.
Used for code validation. If the user specifies an end tag,
HasEndTag is set to
True; otherwise, it is set to False.
GeneratedContent
The content that has been generated by the tag. This includes anything in the
body of the tag, including the results of any active content, such as
ColdFusion variables and functions. You can process this content as a
variable.
AssocAttribs
Contains the attributes of all nested tags if you use cfassociate to make them
available to the parent tags. For more information, see “High-level data
exchange” on page 255.