User Guide

Executing Custom Tags 185
Executing Custom Tags
The following sections provide information on executing custom tags.
Tag instance data
When a custom tag page executes, ColdFusion keeps data related to the tag instance.
The
thisTag built in structured variable preserves this data with a unique identifier.
The behavior is similar to the
File tag-specific variable (sometimes called the File
scope).
The following variables are generated by the
thisTag structure:
Modes of execution
ColdFusion invokes a custom tag page in either of two modes:
Start tag execution
End tag execution
If an end tag is not explicitly provided and shorthand empty element syntax
(<TagName />) is not used, the custom tag page gets invoked only once, in start tag
mode. If a tag must have an end tag provided, use
thisTag.HasEndTag during start
tag execution to validate this.
The same CFML page is executed for both the start and end tag of a custom tag.
Specifying execution modes
A variable with the reserved name thisTag.ExecutionMode will specify the mode of
invocation of a custom tag page. The variable has one of the following values:
Start start tag execution
End end tag execution
When the body of the custom tag (not the custom tag page or template) executes, the
value of the ExecutionMode variable is inactive.
Variable Description
ExecutionMode Valid values are "start" and "end."
HasEndTag Used for code validation. It distinguishes between custom tags
that are called with and without end tags.
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
Holds the attributes of all nested tags if you use cfassociate to
make them available to the parent tags.