Avatar

Correct answer by
Community Advisor

Hi Nick,

If I understand your requirement correctly, your var htmlBlock1 depends upon ( targetData.christmas == 1 ) condition.

You can try below in your delivery:

<%

var htmlBlock1 = ' ' ;

if ( targetData.christmas == 1 )

{

var htmlBlock1 = <table class="flex" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="width:100%; min-width:100%; max-width:600px; mso-cellspacing: 0px; mso-padding-alt: 0px 0px 0px 0px">

  <tr>

    <td class="flex" align="center" style="Margin: 0;padding-left: 0;padding-right: 0;padding-top: 0px;padding-bottom: 0px;" valign="middle" bgcolor="#000000">

      <table class="flex" cellspacing="0" cellpadding="0" border="0" align="center" width="600" style="width:100%; min-width:100%; mso-cellspacing: 0px; mso-padding-alt: 0px 0px 0px 0px">

        <tr>

          <td align="center" style="padding:0; Margin:0"><a style="text-decoration: none;font-weight: bold;font-size: 18px;color: #000001" target="_blank" href=""><img class="flex" src="" alt="Say it with a personalised gift card. Buy a gift card" style="border: none;display: block;height: auto;width: 100%;max-width: 600px;" width="600" border="0" /></a><br/><br/>          

          </td>

        </tr>

      </table>

    </td>

  </tr>

</table>

}

%>

-- HTML Content --

You can call this variable in the HTML content using <%= htmlBlock1 %>

Hope this helps.

Thanks,

Anita

View solution in original post