![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual Download Page 102](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369102.webp)
76
Developing Web Applications with ColdFusion
7.
Open the file
callingpage.cfm
in your browser.
The calling page uses the
getmd
custom tag and displays the results.
Code Review
Tip
Be careful not to overwrite variables that might already exist on the
calling page. You should adopt a naming convention to minimize the
chance of overwriting variables. For example, prefix the returned variable
with customtagname_, with customtagname being the name of the
custom tag.
Note
Data pertaining to the HTTP request or to the current application is
visible. This includes the variables in FORM, URL, CGI, COOKIES,
SERVER, APPLICATION, SESSION, and CLIENT scopes.
The Request scope
is
a reserved variable/scope that allows you to store data pertaining
to the complete hierarchy of custom tags used in a single page request. It is a structure
named "request." The variable is available to all templates: base, includes, and custom
tags. Collaborating custom tags that are not nested in a single tag can exchange data
via the request structure. You should assign a unique name for each variable. You
should store data in structures nested inside the request scope.
Code
Description
<CFSET NameYouEntered="Smith">
In the calling page, create a variable
NameYouEntered and assign it the value
"Smith."
<CF_GETMD NAME="#NameYouEntered#">
In the calling page, call the getMD
custom tag and pass it the NAME
parameter whose value is the value of
the variable NameYou Entered.
<CFPARAM VALUE="Attributes.Name"
DEFAULT="Who"
Assign the value "Who" to Name if it has
no value.
<CFSET CALLER.DOCTOR="Doctor " &
"#ATTRIBUTES.NAME#">
See below. (It is helpful to look at this
code from right to left.)
#ATTRIBUTES.NAME#
Get the value of the variable NAME from
the calling page
<CFSET DOCTOR="Doctor " &
"#ATTRIBUTES.NAME#">
Create a variable called DOCTOR, make
its value "Doctor NAME"
<CFSET CALLER.DOCTOR="Doctor " &
"#ATTRIBUTES.NAME#">
Make the variable’s scope CALLER so
that you can pass it back to the calling
page
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...