User Guide
Chapter 7: Reusing Code 83
• AssocAttribs — holds the attributes of all nested tags if CFASSOCIATE was used
them.
Pattern of execution
The same CFML template is executed for both the start and end tag of a custom tag.
Modes of execution
ColdFusion invokes a custom tag template 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 template will be 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.
Specifying execution modes
A variable with the reserved name ThisTag.ExecutionMode will specify the mode of
invocation of a custom tag template. The variable will have one of the following values:
• Start — start tag execution
• End — end tag execution
During the execution of the body of the custom tag, the value of the ExecutionMode
variable is going to be inactive. In this framework, the template of a custom tag that
wants to perform some processing in both modes may look something like the
following:
<CFIF ThisTag.ExecutionMode is ’start’>
<!--- Start tag processing --->
<CFELSE>
<!--- End tag processing --->
</CFIF>
CFSWITCH can also be used:
<CFSWITCH expression=#ThisTag.ExecutionMode#>
<CFCASE value= ’start’>
<!--- Start tag processing --->
</CFCASE>
<CFCASE value=’end’>
<!--- End tag processing --->
</CFCASE>
</CFSWITCH>