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

When to Use #, and When Not To

Before we go any further, let’s clarify exactly when number signs are needed and when they’re not.

Simply put, number signs are needed to flag functions and variables within a string of text.

In this first example, the number signs are obviously needed:

Hello #VARIABLES.FirstName#

But what about when a variable is used within a tag, like this?

<cfset UpperFirstName=UCase(FirstName)>

Here number signs are not necessary because ColdFusion assumes that anything passed to a tag is a function or variable unless explicitly defined as a string. So the following is incorrect:

<cfset #UpperFirstName#=#UCase(FirstName)#>

This code will actually work (ColdFusion is very forgiving), but it is still incorrect and should not ...

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