About Custom Tags In Cfml; Using Existing Custom Tags; Writing Custom Cfml Tags - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

Chapter 7: Reusing Code

About Custom Tags in CFML

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 re-use while offering off-the-shelf solutions to many
programming chores.
An online RealVideo title called "Creating Custom Tags" is available at the Allaire Alive
section of our Web site. It presents an overview of custom tags as a component
architecture for the emerging Web platform and outlines the creation and use of CFML
custom tags.

Using Existing Custom Tags

Before creating a custom tag in CFML, you will probably want to visit the Custom Tag
section of the Allaire Developer Exchange at . Tags are grouped in several broad
categories and are downloadable as freeware, shareware, or commercial software. You
can quickly view each tag's syntax and usage information. The Gallery contains a
wealth of background information on custom tags and an online discussion forum for
tag topics.
Tag names with the CF_ preface are CFML custom tags; those with the CFX_ preface
are ColdFusion Extensions written in C++. For more information about the CFX tags,
see Chapter 18, "Building Custom CFAPI Tags," on page 275.
If you don't find a tag that meets your specific needs, you want to create your own
custom tags in CFML.

Writing Custom CFML Tags

Writing a custom tag in CFML is no different from writing any CFML template. You can
use all CFML constructs, as well as HTML.
Custom tags are stored either in the current directory or under the
directory. You call them using the CF_ prefix. Beyond that, you are free to use any
naming convention that fits your development practice. Unique descriptive names
make it easy for you and others to find the right tag. For example, the tag name
CF_getweather invokes the file
If you are 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, the
CFMODULE element provides a solution.
Note
getweather.cfm
While tag names in templates are case-insensitive, custom tag file names
must be lower case on UNIX.
73
customtags

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents