Skip to main content
sdettling222
Known Participant
April 20, 2017
Question

Displaying a variable within a db fed var output

  • April 20, 2017
  • 2 replies
  • 842 views

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!!!!

    This topic has been closed for replies.

    2 replies

    WolfShade
    Legend
    April 21, 2017

    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.

    Carl Von Stetten
    Legend
    April 22, 2017

    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.

    Inspiring
    April 21, 2017

    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>