Templates and data

Vestnik1 min readPage 6 of 12
On this page 3

The template subject and body are rendered by the MODX parser: everything from &data (or the $data array) is available as [[+key]], and filters work.

[[!vestnik_notify? &event=`order.paid` &email=`[[+email]]` &data=`{"order_id":"105","fullname":"John"}`]]
  • [[+order_id]] → 105
  • [[+fullname]] → John
  • [[+email]] → the address from &email

Tips

Escaping:      [[+fullname:htmlent]]
Default value: [[+fullname:default=`customer`]]
Condition:     [[+order_id:notempty=`Your order #[[+order_id]]`]]
Branching:     [[+status:is=`paid`:then=`Paid`:else=`Awaiting payment`]]

Keys are case-sensitive: "order_id" → only [[+order_id]]. A missing placeholder outputs nothing, and the :default and :notempty filters work on it.

Recipient data

The email is rendered separately for each recipient: [[+recipient_email]], [[+recipient_name]], [[+recipient_username]], [[+recipient_id]] (username and id only for recipients who are users). [[+email]] and [[+fullname]] remain event data: in an email to managers it is the customer, not the manager.

Sender

The “From” fields (email and name) in the template override vestnik_from_email / vestnik_from_name.