Dynamic Code Tags

The following table provides examples of the valid tags that can be used within dynamic code. Remember, all Dynamic Code must be contained within the {dynamic_code}{/dynamic_code} tags.

Tag Dynamic Code Syntax Example Notes

if

{if...}...{/if}
{if $Contact.firstname eq "Joe"}{/if}. Type: Conditional Expression

The {if} conditional is wrapped in curly braces and can be thought of as a tag.

It is the only operator allowed as the first element of a block and can contain additional operators and comparison expressions.

elseif

{if...}...{elseif...}...{/if}
{if $Contact.in_list."Customer List" eq true} {elseif $Contact.in_list."Client List" eq true} {/if} Type: Conditional Expression

The {elseif} conditional is a child of, and will appear within the {if} conditional.

It cannot appear after the {else} conditional. It can contain additional operators and comparison expressions. The {elseif} conditional does not require a closing tag.

else

{if...}...{else}...{/if}
{if $Contact.in_list."Customer List" eq true} Joe {else} John {/if} Type: Conditional Expression

The {else} conditional is a child of, and the last tag added within the {if} conditional.

It does not contain additional operators and comparison expressions. The {else} conditional does not require a closing tag.

literal

{literal}...{/literal}

{dynamic_code}
{if "%%$cart.status%%" eq "ABANDONED"}
{literal}This is content using {curly_braces}. 
These curly braces will not be interpreted as 
Dynamic Code because they are contained 
within literal tags{/literal}
{/if}
{/dynamic_code}
				

In the code example above, the curly braces contained in the literal tags will be outputted verbatim and will be ignored by the Dynamic Code processor.

Literal tags are placed around content that is displayed to your contacts when the Dynamic Code conditions are met. These tags will display the literal content within them, including anything in curly braces that might otherwise be interpreted as Dynamic Code.
Note: If you choose not to use literal tags, then you can add nested logic to your Dynamic Code. In the absence of literal tags, dynamic code (actually anything in curly braces) will be treated as if it is Dynamic Code. Hence, if you try and use curly braces outside of literal tags, and the curly braces are not part of valid Dynamic Code syntax, you will receive an error.

loop

{loop}...{/loop}
{dynamic_code}
{loop}
%%#item_#%%
{/loop}
{/dynamic_code}
Loop tags are specially formatted API message tags that allow content to be passed in via API Message tags as an array. This an especially useful feature to use with transactional email messages.

For more information about loop tags see API Loop Tags.

cart loop

{cart_loop}...{/cart_loop}
{dynamic_code}{cart_loop}                                                                                   
<tr>
<td>%%$cart.item.name%%</td>
<td>%%$cart.item.category%%</td>
<td>%%$cart.item.description%%</td>
<td>%%$cart.item.other%%</td>
<td>%%$cart.item.sku%%</td>
<td>%%$cart.item.unitprice%%</td>
<td>%%$cart.item.saleprice%%</td>
<td>%%$cart.item.quantity%%</td>
<td>%%$cart.item.producturl%%</td>
</tr>
{/cart_loop}{/dynamic_code}
The {cart_loop} tag allows you to read through the array of line items associated with a shopping cart or an order, and dynamically insert that data into an email message. The message can then be sent via a workflow using the Cart Is Abandoned trigger node.

For more information about cart loops see Cart Loop Tags.

API loop

{loop}%%#item_#%%{/loop}

{dynamic_code}
{loop}
{if "%%#product_id_#%%" eq "12345"}
    {literal}SHIPPING DETAIL{/literal}
{else}
    {literal}SHIPPING DETAILS{/literal}
{/if}
{/loop}
{/dynamic_code}						
API loop tags are specially formatted API message tags that allow content to be passed in via API Message tags as an array. This an especially useful feature to use with transactional email messages.

For more information see API Loop Tags.