Excerpt | ||
---|---|---|
| ||
How to change and customize email templates. |
Blesta 3.0 uses the H2o Template system for parsing Email Tempaltes. The following is an overview of it's basic usage. We've overridden the default {{ var_name }} with { var_name } for simplicity, but that's the only way in which the follow docs differ from any official H2o documentation.
Conditional Statements
Code Block |
---|
{% if id > 3 %}
This will print out if $id is > 3
{% endif %} |
Loops
Code Block |
---|
{% for user in users %}
Name: {user.first_name} {user.last_name}
{% endfor %} |
Assuming:
$users = array(
array(
'first_name'=>"First name",
'last_name'=>"Last name"
),
array(
'first_name'=>"First name 2",
'last_name'=>"Last name 2"
)
);
Loops can also take advantage of limits:
Code Block |
---|
{% for user in users limit:1 %} |
The above would only cycle through the loop one time.
Filters
Filters are applied to individual variables and are preceded by a pipe symbol (|). These will likely not be used. See /vendors/h2o/h2o/filters.php for a complete list.
Code Block |
---|
{past_due | default 'Not past due'} // Produces "Not past due" if past_due is false |
Multiple filters can be applied in succession:
Code Block |
---|
{past_due | default 'not past due' | capitalize} // Produces NOT PAST DUE if past_due is false |