Skip to main content
Participant
November 17, 2013
Question

Coldfusion only displays variable names, not variables.

  • November 17, 2013
  • 1 reply
  • 1870 views

Hi! I'm just getting started with ColdFusion and I'm having difficulties already. I have the following:

<cfset firstname="bob">

<p style="font-color:#ccccc">Hello <cfoutput>#firstname#</cfoutput> it is so nice to see you</p>

But instead of saying "Hello Bob it is so nice to see you"

it says

"Hello #firstname# it is so nice to see you."

I'm using xammp for apache and using dreamweaver. Can anyone help me figure out why this isn't working correctly?

This topic has been closed for replies.

1 reply

Inspiring
November 18, 2013

First, be careful with using the hash tag in a CFML page.  Your inline style on the <p> element not only has an incorrect number of hexadecimal characters (you can have 3 or 6 characters, not 5), you also got to be careful when you specify the hash itself.  Also, there is no such CSS property as "font-color".  I believe you want to use "color", ie:

<p style="color: ##ccc;">Hello <cfoutput>#firstname#</cfoutput>.  It is so nice to see you.</p>

Try that and let me know what you get.

jase1126Author
Participant
November 18, 2013

Nope, didn't change anything. I'm still having it say "Hello #firstname#" instead of "Hello Bob"

Inspiring
November 18, 2013

Did you by chance name this file with a non-ColdFusion extension?

For example, if you write that code and then save the file as anything other than .cfm or .cfml, then ColdFusion never gets the chance to execute the code.