Using Custom Tags - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

Using Custom Tags

6
7
Note
The file header.cfm must be in the same directory where you saved askemp.cfm and
getemp.cfm (or a subdirectory). If it is not, make sure it is in a directory that has a
mapping defined in ColdFusion Administrator, or move it to the appropriate
directory.

Using Custom Tags

Custom tags wrap functionality in a page that can be called from a ColdFusion
application page. ColdFusion custom tags built in CFML allow for rapid application
development and code reuse while offering off-the-shelf solutions to many
programming chores.
You use a custom tag just as you would use a standard HTML or ColdFusion tag, for
example, you might call a custom tag to generate a happy birthday message as
follows:
<CF_HappyBirthday name="Ted Cantor" birthDate="December, 5, 1987">
A custom tag can also have a body and end tag, for example:
<CF_HappyBirthdayMessge name="Ellen Janes" birthDate="June, 8, 1993">
<P> Happy Birthday Ellen!</P>
<P> May you have many more!</P>
</CF_HappyBirthdayMessage>
You call custom tags by adding the
suffix). For example, use the tag name
You must store custom tags that you call directly in either the same directory as the
calling page, in the CFUSION\CustomTags directory, or in a subdirectory of the
CFUSION\CustomTags directory. Each file defines a single custom tag.
You can also use the
specify the location of the custom tag file. The
concerned about possible name conflicts when invoking a custom tag or if the
application must use a variable to dynamically call a custom tag at runtime. For
more information on using the
Include the header.cfm file in this page:
<cfinclude template="header.cfm">
View askemp.cfm in a browser, then submit the form so that you display
getemp.cfm.
The header should appear on both pages.
cfmodule
prefix to the filename (without the .cfm
cf_
cf_getweather
tag to call custom tags. The
cfmodule
tag, see theCFML Reference.
cfmodule
to call the file getweather.cfm.
tag lets you
cfmodule
tag is useful if you are
173

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents