Single vs Double Braces

Most of the time, you can use single and double braces interchangeably on Sailthru. This:

<p>Dear {name},</p>

usually means the same thing as this:

<p>Dear {{name}},</p>

The difference is if you are generating blast content from a template. In this case, in your template:

  • expressions in {single braces} are evaluated at generate time, just once overall
  • expressions in {{double braces}} are evaluated at send time, once for each individual user

For example, let's suppose you wanted your email to contain the current date. If this is what's in your template:

generated on {date()}
sent on {{date()}}

If you generate a campaign from this template on July 27, the following will appear in your campaign's HTML source:

generated on July 27, 2011
sent on {date()}

Then let's say you don't send it out until the next day. Users will see this:

generated on July 27, 2011
sent on July 28, 2011

Why Does This Matter?

If you are reading a data feed and want to turn it into static HTML that you can edit before it goes out, you want to use {single braces} around the content that you want to be able to edit as static HTML.

You should use {{double braces}} around dynamic content like ads or sharing links that should render differently for every user.

 
/var/www/docs.sailthru.com/htdocs/data/pages/syntax/braces.txt · Last modified: 2011/02/24 18:27 by Ian White
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki