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

How to evaluate a string that contains a cfif tag?

Guest
Aug 20, 2008 Aug 20, 2008

Copy link to clipboard

Copied

Line 1 of the attached code has the output I want: "test that string".

Lines 2 and 3 aren’t getting the browser output I want: "test thisthat string".
Here is what lines 2 and 3 look like in the view source: "test <cfif 1 EQ 0>this<cfelse>that</cfif> string"

How to evaluate str so it prints "test that string"?

Thank you in advance.
TOPICS
Advanced techniques

Views

487

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

correct answers 1 Correct answer

Community Expert , Aug 21, 2008 Aug 21, 2008
How to evaluate str so it prints "test that string"?

Coldfusion wouldn't evaluate a tag that is part of a string. Use the functions iif() and de(). Your str should be something like

<cfset str = "test " & iif(1 EQ 0, de("this"), de("that")) & " string">

Votes

Translate

Translate
Community Expert ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

LATEST
How to evaluate str so it prints "test that string"?

Coldfusion wouldn't evaluate a tag that is part of a string. Use the functions iif() and de(). Your str should be something like

<cfset str = "test " & iif(1 EQ 0, de("this"), de("that")) & " string">

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