Cfif/Cfelseif/Cfelse - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

100

CFIF/CFELSEIF/CFELSE

Used with CFELSE and CFELSEIF, CFIF lets you create simple and compound
conditional statements in CFML. The value in the CFIF tag can be any expression.
Syntax
<CFIF expression>
HTML and CFML tags
<CFELSEIF>
HTML and CFML tags
<CFELSE expression>
HTML and CFML tags
</CFIF>
Usage
Note that when testing for the return value of any function that returns a Boolean, you
do not need to explicitly define the TRUE condition. The following code uses IsArray as
an example:
<CFIF IsArray(myarray)>
When successful,
This method is preferred over explicitly defining the TRUE condition:
<CFIF IsArray(myarray) IS TRUE>
Note
<CFIF "11/23/1998 " GT "11/15/1998 ">
This switch is set on the ColdFusion Administrator Server Settings page. Please refer to
Administering ColdFusion Server for more information about ColdFusion settings.
Example
<!--- This example shows the interaction of CFIF, CFELSE,
and CFELSEIF --->
...
<H3>CFIF Example</H3>
<P>CFIF gives us the ability to perform conditional logic
based on a condition or set of conditions.
<P>For example, we can output the list of Centers from the
snippets datasource by group and only display them <B>IF</B>
the city = San Diego.
<hr>
<!--- use CFIF to test a condition when outputting a query --->
<P>The following are centers in San Diego:
<CFOUTPUT QUERY="getCenters" >
<CFIF city is "San Diego">
<BR><B>Name/Address:</B>#Name#, #Address1#, #City#, #State#
<BR><B>Contact:</B> #Contact#<BR>
</CFIF>
evaluates to YES, the string equivalent of the Boolean TRUE.
IsArray
On UNIX, there is a switch that provides fast date-time parsing. If you
have enabled this switch, you must refer to dates in expressions in the
following order: month, day, and year. For example:
CFML Language Reference

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents