Adobe COLDFUSION 9 Manual page 161

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Building Blocks of ColdFusion Applications
About creating functions by using tags
You use the
tag to define a UDF in CFML. The
cffunction
limitations:
• Developers who have a background in CFML or HTML, but no scripting or programming experience are more
familiar with the syntax.
• You can include any ColdFusion tag in your function definition. Therefore, you can create a function, for example,
that accesses a database.
• You can embed CFScript code inside the function definition.
• The
tag provides attributes that enable you to easily limit the execution of the tag to authorized users
cffunction
or specify how the function can be accessed.
The following code uses the
<cffunction name="twoPower" output=True>
<cfargument name="exponent">
<cfreturn 2^exponent>
</cffunction>
For more information on how to use the
cffunction
tag" on page 156.
Defining functions by using the cffunction tag
The
and
cffunction
cfargument
For information on ColdFusion components, see
more information on the
cffunction
The cffunction tag function definition format
A
tag function definition has the following format:
cffunction
<cffunction name="functionName" [returnType="type" roles="roleList"
access="accessType" output="Boolean"]>
<cfargument name="argumentName" [Type="type" required="Boolean"
default="defaultValue">]
<!--- Function body code goes here. --->
<cfreturn expression>
</cffunction>
where brackets ([]) indicate optional arguments. You can have any number of
The
tag specifies the name you use when you call the function. You can optionally specify other function
cffunction
characteristics, as the following table describes:
tag to define the exponentiation function:
cffunction
tag to define a function, see
cffunction
tags let you define functions in CFML without using CFScript.
"Building and Using ColdFusion
tag, see the CFML Reference.
Last updated 8/5/2010
tag syntax has the following features and
cffunction
"Defining functions by using the
Components" on page 177. For
cfargument
156
tags.

Advertisement

Table of Contents
loading

Table of Contents