How do I display a variable in a variable?

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default How do I display a variable in a variable?

    I have a email page that allows you to choose from 5 content sections from a
    database fields. The data in the database is actual HTML Code put in by a
    online WYSIWYG form. So it html.. When the email gets sent it grabs the HTML
    from the database field as a varibale called : See example below

    <tr>
    <td>#htmlbody1# </td>
    <td>#htmlbody2# </td>
    </tr>

    and renders correctly. MY QUESTION IS inside the #htmlbody1# there is HTML
    code and I want to append a coldfusion varibale to a hyperlink in the the HTML
    that is really #HTMLBODY1#

    However when processed the #htmlbody1# is processed butnot the varibale nested
    inside the data that #htmlbody1# contains.

    I hope this makes sense.

    #HTMLBODY1# contains the following code for instance when processed :
    <tr><td>Hello world <a href="http://www.mysite.com?email=#e_email#"></td></r>

    The e_email doesnt process becuase its embedded inside the #HTMLBODY1#

    any help would be great.



    moyerc Guest

  2. Similar Questions and Discussions

    1. Can Flash display a CF variable value dynamically?
      Title pretty much sums it up. Want my flash movie to include text pulled from a CFQUERY. I know there is a "dynamic text" option in the property...
    2. how to display a javascript variable value
      Hi, I have a value in a hidden variable and the other value in a javascript variable. I want to display these two values by using coldfusion. Any...
    3. Can I display a frame number as variable?
      I want to set up a book of sorts and I was wondering how I might go about scripting a variable to display what stop frame the user is on. Can...
    4. How do I display the name of a variable?
      I have a script (below) that can be passed an array and it will dump the contents of the array in to an html table - I use it during development so...
    5. Display variable with spaces
      Hello, I am trying to display the rows of a MySql Query in a table. I retrieve the result using the query : while ($row =...
  3. #2

    Default Re: How do I display a variable in a variable?

    This is just a SWAG, but perhaps you need to use CFOUTPUT tags, or possibly EVALUATE().

    Phil
    paross1 Guest

  4. #3

    Default Re: How do I display a variable in a variable?

    Evaluate() can be tricky and slow.

    This approach should work and might be easier to understand. You also might
    want to do the string processing before the CFMail tag.

    Use:
    <td>#ReplaceNoCase (htmlbody1, "##e_email##", e_email, "ALL")# </td>
    OR
    <CFSET sNewBody = ReplaceNoCase (htmlbody1, "##e_email##", e_email, "ALL")>

    The "ALL" is optional if the variable only occurs one time. In that case
    omitting it would save a few microseconds.

    Cheers,
    -- MikeR


    MikerRoo Guest

  5. #4

    Default Re: How do I display a variable in a variable?

    It worked! Your awesome!

    Thank you, so much! I been trying to figure this out forever, just thought it couldn't be done.

    Thanks again!
    moyerc Guest

  6. #5

    Default Re: How do I display a variable in a variable?

    It worked! Your awesome!

    Thank you, so much! I been trying to figure this out forever, just thought it couldn't be done.

    Thanks again!
    moyerc Guest

  7. #6

    Default Re: How do I display a variable in a variable?

    It worked! Your awesome!

    Thank you, so much! I been trying to figure this out forever, just thought it couldn't be done.

    Thanks again!:beer;
    forumnotifier Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139