Assignment

You can use the = operator to do assignments to local variables. 1)

{variable = value}
{variable.attribute = value}

This is especially useful if you are calculating content that you want to loop through. It's usually more convenient to assign these to a temporary variable that you can use later:

{personalized_headlines = horizon_select(content,10)}

When you make an assignment, it only applies to the particular message you are sending and will not cause any kind of permanent update to your data.

So if you do something like this:

{if !name}
{name = 'Friend'}
{/if}
Dear {name},

Your assignment will only last the duration of the message scope. You are not permanently setting the user's name to "Friend".

1) This replaces the old set() function, which we will leave in for backwards compatibility.
 
/var/www/docs.sailthru.com/htdocs/data/pages/syntax/assignment.txt · Last modified: 2011/04/05 16:39 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