Passing Data Between Nested Custom Tags; What Data Is Accessible; Where Is Data Accessible; High-Level Data Exchange - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

Passing Data Between Nested Custom Tags

Passing Data Between Nested Custom Tags

A key custom tag feature is the ability of collaborating custom tags to exchange
complex data without user intervention while encapsulating each tag's
implementation so that others cannot see it.
When you decide to you use nested tags, you must address the following issues:

What data is accessible?

To enable developers to obtain maximum productivity in an environment with few
restrictions, CFML custom tags can expose all their data to collaborating tags.
When you develop custom tags, you should document all variables that
collaborating tags can access and/or modify. When your custom tags collaborate
with other custom tags, you should make sure that they do not modify any
undocumented data.
To preserve encapsulation, put all tag data access and modification operations into
custom tags. For example, rather than simply documenting that the variable
MyQueryResults in a tag's implementation holds an important query result set and
expecting users of the custom tag to manipulate MyQueryResults directly, create
another nested custom tag that manipulates MyQueryResult. This protects the users
of the custom tag from changes in the tag's implementation.

Where is data accessible?

Two custom tags can be related in a variety of ways in a page. Ancestor and
descendant relationships are important because they relate to the order of tag
nesting.
A tag's descendants are inactive while the page is executed, that is, the descendent
tags have no instance data. A tag, therefore, can only access data from its ancestors,
not its descendents. Ancestor data is be available from the current page and from the
whole runtime tag context stack. The tag context stack is the path from the current
tag element up the hierarchy of nested tags, including those in included pages and
custom tag references, to the start of the base page for the request. Both
tags and custom tags appear on the tag context stack.

High-level data exchange

There are many cases in which descendant tags are used only as a means for data
validation and exchange with an ancestor tag, such as
cftree/cftreeitem
processing.
What data should be accessible?
Which tags can communicate to which tags?
How are the source and targets of the data exchange identified?
What CFML mechanism is used for the data exchange?
. You can use the
cfhttp
tag to encapsulate this
cfassociate
181
cfinclude
/
and
cfhttpparam

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 5

Table of Contents