Drafting templates with conditions!

Nestor uses a programming language to generate text in messages. You can harness this and use branching conditions in your templates: https://twig.symfony.com/doc/2.x/tags/index.html. The configuration is a bit technical, but will result in:

The description below gives one typical example, but the possibilities are endless.



E-mail conditions: a case study

Let us consider the case of the acceptance letter, where we want to:

For this purpose, we could create two different templates:

Template for a "regular article"
Template for a "note to the editor"

Dear author,


Congratulations on being accepted! We have received all source files and your paper is now in the hands of the copy editor.


You will receive the galley proofs in about two weeks.


Best regards,

The Editorial Office

Dear author,


Congratulations on being accepted! We have received all source files and your note to the editor is about to be published!


You will receive the galley proofs by tomorrow.


Best regards,

The Editorial Office

This presents the following downsides:

image.png



Instead, let us create one single template, inserting cool conditions when needed:

Global template

Dear author,


Congratulations on being accepted! We have received all source files and your {% if article.articleType.code == 'REGULAR' %}paper is now in the hands of the copy editor{% else %}note to the editor is about to be published!{% endif %}.


You will receive the galley proofs in about {% if article.articleType.code == 'REGULAR' %}two weeks{% else %}by tomorrow{% endif %}.


Best regards,
The Editorial Office

This results in a single template to maintain, and a cleaner editor interface:

image.png




Revision #5
Created 11 May 2023 07:33:24 by Nestor
Updated 6 June 2023 13:03:08 by Nestor