Cfabort And Cfexit; Comments; Special Characters - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

cfabort and cfexit

The
tag stops processing of the current page at the location of the
cfabort
ColdFusion returns to the user or calling tag everything that was processed before the
tag. You can optionally specify an error message to display. You can use the
body of a
tag to stop processing a page when a condition, typically an error, occurs.
cfif
The
tag controls the processing of a custom tag, and can only be used in ColdFusion
cfexit
custom tags. For more information see,
CFML Reference.

Comments

ColdFusion comments have a similar format to HTML comments. However, they use three dash
characters instead of two; for example:
<!--- This is a ColdFusion Comment. Browsers do not receive it. --->
The ColdFusion server removes all ColdFusion comments from the page before returning it to
the web server. As a result, the page that a user browser receives does not include the comment,
and users cannot see it even if they view the page source.
You can embed CFML comments in begin tags (not just tag bodies), functions calls, and variable
text in pound signs. ColdFusion ignores the text in comments such as the following:
<cfset MyVar = var1 <!--- & var2 --->>
<cfoutput>#Dateformat(now() <!---, "dddd, mmmm yyyy" --->)#</cfoutput>
This technique can be useful if you want to temporarily comment out parts of expressions or
optional attributes or arguments.
Note: You cannot embed comments inside a tag name or function name, such as
. You also cannot embed comments inside strings, as in the following example:
-->CustomTag>
IsDefined("My<!--- New --->Variable")

Special characters

The double quotation marks ("), single quotation mark ('), and pound sign (#) characters have
special meaning to ColdFusion. To include any of them in a string, double the character; for
example, use ## to represent a single # character.
The need to escape the single- and double-quotation marks is context-sensitive. Inside a double-
quoted string, you do not need to escape single-quote (apostrophe) characters. Inside a single-
quoted string, you do not escape double-quote characters.
The following example illustrates escaping special characters, including the use of mixed single
and double quotes.
<cfset mystring = "We all said ""For He's a jolly good fellow.""">
<cfset mystring2 = 'Then we said "For She''s a jolly good fellow".'>
<cfoutput>
#mystring#<br>
#mystring2#<br>
Here is a pound sign: ##
</cfoutput>
50
Chapter 2: Elements of CFML
Chapter 9, "Terminating tag execution," on page 185
.
tag.
cfabort
cfabort
tag as the
cfabort
and
<cf_My<!--- New -

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Coldfusion mx

Table of Contents