Email Booleans - How do you implement them?

SanfordWhiteman
Level 10 - Community Moderator

Re: Email Booleans - How do you implement them?

but some email clients/servers break (or don't honor) this boolean logic.

Clients, surely.

I assume the reason that forwarding breaks Paul's method is that, cool as it is (and it is) it technically breaks the HTML standard for comments and those clients "catch on" when they reparse the HTML for forwarding. (If you read the standard, the open-comment string "<!--" is not actually allowed within an already-open comment, but browsers/clients can choose at times to be more forgiving.)

If you can use the Velocity technique I mention here, the result is standards-compliant: Dynamically Showing Module in Email Based on Segment

Re: Email Booleans - How do you implement them?

We discover a great way to hide or show an element with boolean switches. You should use that only when it's not possible to use the "Delete" module functionality. It is true that using a switch to hide an element will leave the code in the email your contacts will receive. It is also accurate there is a good chance if the email is forwarded the result won't be what you expect, you need to use it sparingly. Utilize it for example to hide an element in a multi-column layout.

This is an example to hide a button; the switches syntax needs to be like this:

<meta class="mktoBoolean" id="ShowBtn" mktoName="Button" default="true" false_value="display:none; max-height:0px; height:0px; max-width:0px; opacity:0; overflow:hidden;" true_value="cursor:auto;" false_value_name="Off" true_value_name="On" mktoModuleScope="true" />

The idea of using "cursor:auto;" is to use some CSS that won't enter in conflict with your existing one. 

For the false value, "display:none" will work in every email client except Lotus and Outlook. The rest of the CSS will work in every version of Lotus and Outlook, but you need to add the variable on EVERY tag of the element you want to hide. Add the variable to every HTML tag, and at the very end of existing inline CSS.

Example:

<tr style="${ShowBtn}">
<td class="w25" align="${BtnAlignRight01}" valign="top" style="padding-right:40px; ${ShowBtn}">
<table class="button" cellpadding="0" cellspacing="0" border="0" align="${BtnAlignRight01}" style="${ShowBtn}">
<tr style="${ShowBtn}">
<td bgcolor="${BtnColor}" class="button" align="center" valign="middle" style="border:${BtnBorderSize}px solid ${BtnBorderColor}; -webkit-border-radius:${BtnRadius}px; -moz-border-radius:${BtnRadius}px; border-radius:${BtnRadius}px; padding-right:${BtnSideSpace}px; padding-left:${BtnSideSpace}px; padding-top:${BtnTopSpace}px; padding-bottom:${BtnBotSpace}px; font-family:${CustomFontFamily}; font-size:${BtnFontSize}px; line-height:${BtnLineHeight}px; color:${BtnLabelColor}; display:block; mso-line-height-rule:exactly; font-weight:${BtnFontWeight}; text-decoration:none; text-align:center; ${ShowBtn}">
<a href="${BtnLink}" style="color:${BtnLabelColor}; text-decoration:none; ${ShowBtn}">
<span style="color:${BtnLabelColor}; text-decoration:none; ${ShowBtn}">${BtnLabel}</span>
</a>
</td>
</tr>
</table>
</td>
</tr>‍‍‍‍‍‍‍‍‍‍‍‍‍

Let me know if it helps,

Eric

SanfordWhiteman
Level 10 - Community Moderator

Re: Email Booleans - How do you implement them?

Can you highlight your code using the Syntax Highlighter so it's more readable? Choose XML/HTML from the dropdown.