Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 216

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Building Blocks of ColdFusion Applications
You can also include end tags when calling your custom tags, as the following example shows:
<mytags:custom_tag_name attribute1=val_1 attribute2=val_2>
...
</mytags:custom_tag_name>
ColdFusion calls the custom tag page twice for a tag that includes an end tag: once for the start tag and once for the
end tag. For more information on how ColdFusion handles end tags, and how to write your custom tags to handle
them, see
"Handling end
tags" on page 217.
One of the advantages to using the
organize them by category. For example, you can place all security tags in one directory, and all interface tags in
another. You then import the tags from each directory and give them a different prefix:
<cfimport prefix="security" taglib="securityTags">
<cfimport prefix="ui" taglib="uiTags">
...
<security:validateUser name="Bob">
...
<ui:greeting name="Bob">
...
Reading your code becomes easier because you can identify the location of your custom tags from the prefix.
Securing custom tags
The ColdFusion security framework enables you to selectively restrict access to individual tag files and tag directories.
This feature can be an important safeguard in team development. For details, see Configuring and Administering
ColdFusion.
Accessing existing custom tags
Before creating a custom tag in CFML, review the free and commercial custom tags available on the Adobe developer's
exchange (www.adobe.com/go/learn_cfu_cfdevcenter_en).You might find a tag that does what you want.
Tags are grouped in several broad categories and are downloadable as freeware, shareware, or commercial software.
You can 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
_ preface are CFML custom tags; those tags with the
cf
written in Java or C++. For more information about the CFX tags, see
If you do not find a tag that meets your specific needs, you can create your own custom tags in CFML.
Passing data to custom tags
To make your custom tags flexible, you often pass data to them for processing. To do so, you write custom tags that
take tag attributes and other data as input from a calling page.
Passing values to and from custom tags
Because custom tags are individual ColdFusion pages, variables and other data are not automatically shared between
a custom tag and the calling page. To pass data from the calling page to the custom tag, you can specify attribute name-
value pairs in the custom tag, just as you do for normal HTML and CFML tags.
For example, to pass the value of the NameYouEntered variable to the cf_getmd tag, you can call the custom tag as
follows:
tag is that you can define a directory structure for your custom tags to
cfimport
Last updated 1/20/2012
preface are ColdFusion extensions
cfx_
"Building Custom CFXAPI
Tags" on page 224.
211

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents