You can use conditional/logic helpers to insert different content depending on certain conditions.
if/else block helper conditionally renders blocks of content.
else if statements render content when the condition is true, and
else renders content when all previous conditions are false.
Here are some examples of how you can use it.
Insert first name when available
to.first_name is available, the template will render
Hello John. If
to.first_name is not available, the template will render
Change the template variables to see it works.
Insert content when people are CC'd
and/or helpers allow to string together complex conditions for rendering.
You can use the
and helper by itself to render the last true value, if all values are true. The
or helper, used by itself, will render the first true value, if at least one value is true.
Both of them can be combined with the
if helper, as subexpressions, to check for multiple values.
Insert first name if last name is available
Insert first or last name if available
Insert a default if first name is not available
Insert full name only if both first name and last name are available
compare helper lets you check if two, or more, values are equal or not. The helper requires at least three parameters: the operator (can be one of
>=), and at least two values. You can also add more values if you want to compare three or more.
and/or helpers, you can combine the
compare helper with the
if block helper to conditionally render different blocks of content.
Insert different content for a specific email
Check if email is not equal
Greater than and Less than
compare helper can also be used to check if a value is greater, or less, than another, by using the