Passing Attribute Values Between Custom Tags - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

74
Defining attributes
CFML custom tags support both required and optional attributes. Attributes are
defined as name-value pairs. Custom tag attributes conform to CFML coding
standards:
ColdFusion passes any attributes in the ATTRIBUTES scope.
Use the CFPARAM tag at the top of a custom tag to test for and assign defaults
for each attribute that may be passed from a calling template.
Use the ATTRIBUTES.attribute_name syntax when initializing passed attributes
to distinguish them from local ones.
Attributes are case-insensitive.
Attributes may be listed in any order within a tag.
Attribute = value pairs for a tag must be separated by a space.
Passed values that contain spaces must be enclosed in double-quotes.

Passing Attribute Values between Custom Tags

Because custom tags are individual templates, variables and other data aren't
automatically shared between a custom tag and the calling template. To pass data, you
define attributes for the custom tag, just as in standard CFML coding.
To pass data from the calling template to the custom tag, use the ATTRIBUTES scope.
Conversely, to pass values back to the calling template, use the CALLER scope. You can
also access variables already set on the calling page in the custom tag by simply
prefixing the variable with the 'CALLER.' prefix.
To create a custom tag:
1.
Create a new application page (the calling page) in Studio.
2.
Modify the file so that it appears as follows:
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents