O'Reilly logo

Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started by Charlie Arehart, Raymond Camden, Ben Forta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Multiple If Statements

There’s one more feature of <cfif> that you need to look at—support for multiple independent conditions (as opposed to one condition made up of multiple conditions).

The best way to explain this is with an example. In the previous listings, you displayed a message on weekends. But what if you wanted to display different messages on Sunday and Saturday? You could create multiple <cfif> </cfif> blocks, but there is a better way.

Listing 9.5 contains yet another version of the code; this time the file name should be if5.cfm.

Listing 9.5. if5.cfm
<!--- Name: if5.cfm Author: Ben Forta (ben@forta.com) Description: Demonstrate <cfelseif> use Created: 07/01/2007 ---> <html> <head> <title>If 5</title> </head> <body> <!--- Get day ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required