Article

Blesta 3.0: Emails (video)

December 31, 2011 | Posted by Paul


It’s the end of the year and I can hardly believe it. I hope everyone had a nice Christmas, and has a nice New Years!

This weeks video is about emails, largely email templates and here are some of the highlights:

  1. Email Signatures are new to v3, and were highly requested.
  2. Tons of data available to templates besides just strings, such as objects, and arrays.
  3. Conditionals, loops, and filters are now supported for powerful template control.
  4. Improved layout and usability overall.

Here are some examples of conditionals, loops, and filters.

Conditionals

{% if id > 3 %}
    This will print out if $id is > 3
{% endif %}

Loops

{% for user in users %}
    Name: {user.first_name} {user.last_name}
{% endfor %}
 
This Assumes:
 
$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. This would only cycle through the loop 1 time:

{% for user in users limit:1 %}

Filters

{past_due | default 'Not past due'} // Produces "Not past due" if past_due is false

Multiple filters can be applied in succession:

{past_due | default 'not past due' | capitalize} // Produces NOT PAST DUE if past_due is false

You get the idea, a lot can be done with templates and all of this and more will be in the documentation.

The video is below, as usual you can make the video full screen, and be sure to turn on your sound. Alright — as we head out for the weekend, see you next year! It’s going to be a good one!

Tags: