var and specifying a unique variable name after the mandatory $. In addition, there are also global variables provided by WEBSALE (modules). These always begin with $ws and contain predefined functions or data fields.
{{ var $myVariable = 10 }} | The variable $myVariable is newly created and the value 10 is stored in it. |
{{ $myVariable = 42 }} | The value 42 is stored in the already created variable $myVariable. |
{{= $myVariable }} | Output the current contents of $myVariable: 42 |
Note:
{{= $myVariable }} outputs the value escaped/filtered (special characters/HTML are “neutralized” and displayed as text). To output the contents unfiltered, you must use {{! $myVariable}}.Assigning a value to a variable that has not been created — as with all invalid variable accesses — causes an error in the compiler. Creating a variable with a name that is already in use is not allowed in the same template.