User Guide

84 Developing Web Applications with ColdFusion
Terminating tag execution
CFEXIT terminates execution of a custom tag. CFEXIT’s METHOD attribute specifies
where execution continues. CFEXIT can specify that processing continues from the
first child of the tag or continues immediately after the end tag marker.
The METHOD attribute can also be used to specify that the tag body should be
executed again. This enables custom tags to act as high-level iterators, emulating
CFLOOP behavior.
The following table summarizes CFEXIT behavior:
Access to generated content
Custom tags can access and modify the generated content of any of its instances using
the ThisTag.GeneratedContent variable. In this context, the term generated content
means the portion of the results that is generated by the body of a given tag. This
includes all results generated by descendant tags, too. Any changes to the value of this
variable will result in changes to the generated content.
ThisTag.GeneratedContent is always empty during the processing of a start tag. Any
output generated during start tag processing is not considered part of the tag’s
generated content.
As an example, consider a tag that comments out the HTML generated by its
descendants. Its implementation could look something like this:
CFEXIT Behavior in a Custom Tag
METHOD Attribute Value Location of CFExit Call Behavior
ExitTag (default) Base template Acts like CFABORT
ExecutionMode=start Continue after end tag
ExecutionMode=end Continue after end tag
ExitTemplate Base template Acts like CFABORT
ExecutionMode=start Continue from first child
in body
ExecutionMode=end Continue after end tag
Loop Base template Error
ExecutionMode=start Error
ExecutionMode=end Continue from first child
in body