• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Coldfusion only displays variable names, not variables.

New Here ,
Nov 17, 2013 Nov 17, 2013

Copy link to clipboard

Copied

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?

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 17, 2013 Nov 17, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 17, 2013 Nov 17, 2013

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 17, 2013 Nov 17, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 17, 2013 Nov 17, 2013

Copy link to clipboard

Copied

It's saved as .cfm

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 18, 2013 Nov 18, 2013

Copy link to clipboard

Copied

<cfset firstname="bob">

<cfoutput>Test -#firstname#</cfoutput>

Please check it, If you get the output as Test -bob;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 18, 2013 Nov 18, 2013

Copy link to clipboard

Copied

Looks like CF is not serving pages, and that .cfm pages are being served literally as text files.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 18, 2013 Nov 18, 2013

Copy link to clipboard

Copied

Yup.  That would be my next guess.

ColdFusion isn't even hitting the request.  This could either be that the connector script is not working, as such, ColdFusion is not responsible for handling files it should be handling, or the server environment is preventing ColdFusion from executing (the latter should return in an error, and not just a code dump like we're seeing)

I'm not familiar with Apache, but can you see if there is a "Web Server Configuration Tool" installed?  On a Windows/IIS setup, it allows you to add/remove connectors from ColdFusion to the web server.  If you have this tool installed, I'd recommend removing the connectors from Apache, and then re-connecting them.

Your code, though not in best practice, should at least be valid (if using what I provided), so for the return to still have CF variables output to the screen means that there's a setup issue.

Are you able to get into the CFIDE Administrator?  Usually, the URL is:  http://serverHostname/CFIDE/administrator/index.cfm (or http://serverHostname:8500/CFIDE/administrator/index.cfm for standalone installs)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2013 Nov 18, 2013

Copy link to clipboard

Copied

I don't have a "Web Server Configuration Tool" installed, or at least can't find it. Maybe that's whats causing it? And I still get a code dump with the example you gave.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 18, 2013 Nov 18, 2013

Copy link to clipboard

Copied

Usually, when you install CF10, a browser needs to open up so the server can finish up the configuration of the installation.  Afterwards, it usually takes you to the Administrator.  Did you get to this step?  Have you ever logged into the CF Administrator?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2013 Nov 18, 2013

Copy link to clipboard

Copied

LATEST

Yes, I have.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation