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:

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.

The following example accesses the ExecutionMode variable of the thisTag structure from within a custom tag:

<cfif thisTag.ExecutionMode is 'start'>

View comments in LiveDocs