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.
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...