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

Displaying a variable within a db fed var output

New Here ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

Hello all, I search the forums and could not find a solution to this..... but I am sure it is an easy fix....

I have a site that is storing image info copy etc.... However I have a footer that contains all the disclaimer crap. So I store it in the database record like this:

------

You agree to abide by and comply with these terms and conditions by accessing, using or downloading any material from or on your account.

<br><br>

©#DateFormat(Now(), "yyyy")# ABC LLC. All Rights Reserved

-------

The <br>'s are being displayed correctly, but you can see that the dateformat tag is being displayed as the coded variable and not "2017"

I double checked that all the code is within a cfoutput. Just at a loss so any feedback would be greatly appreciated.

Thanks!!!!

Views

687

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
Advocate ,
Apr 21, 2017 Apr 21, 2017

Copy link to clipboard

Copied

You are probably going to have to use Evaluate() evaluate Code Examples and CFML Documentation

Or just add a template text in the footer which you can replace while outputting. I.e. ©%CURRENT_YEAR_HERE% ABC LLC. All Rights Reserved

Something like this. Just a rough idea.

<cfoutput>#Replace(thefooter, "%CURRENT_YEAR_HERE%", "#DateFormat(Now(), "yyyy")#)#</cfoutput>

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
LEGEND ,
Apr 21, 2017 Apr 21, 2017

Copy link to clipboard

Copied

Something, somewhere, must be closing your opening CFOUTPUT tag before the disclaimer, and reopening it after.

V/r,

^_^

PS  Even though the Evaluate() function doesn't have as much overhead as it used to, I still avoid using Evaluate() for anything.  I just consider it bad practice.

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
Guide ,
Apr 21, 2017 Apr 21, 2017

Copy link to clipboard

Copied

LATEST

I'm pretty sure that ColdFusion won't execute any CF-specific code within a <cfoutput> tag unless you wrap it with Evaluate(), as haxtbh​ suggested.

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