Templates

A template is a text document that can produce HTML, text, and other formats. This document is stored in the Content Library and can be edited, manipulated and controlled using the Content Library, or by working in the Message Designer for Email.

You can upload templates as files, and they will be stored in the Content Library.  You can also enter definitions for text generation using the Message Designer for Email.

The template at a glance

The simplest template is an HTML or plain text file. When the system emails a user, RPL sends that HTML as is. However, to make the message to be more dynamic, you can include instructions for RPL in the HTML:

Interpolations

Interpolations contain instructions to convert an expression to text and to insert that text into the output. An interpolation begins with ${ and ends with }. Note that interpolations do not obtain a value, they only execute an expression.

RPL tags

RPL tags are a similar to HTML tags. The tags start with #. User-defined RPL tags use @ instead of #.

RPL tags refer to directives. You can think of "RPL tag" and "directive" as synonyms.

Comments

Comments are similar to HTML comments, but they are delimited by <#-- and -->. Anything between these delimiters is not written to the output.

Everything in the template except interpolations, RPL tags, and comments is considered static text, and is printed to the output as is (with the exception of rules for space truncation).

Working with templates

Templates are programs you write in RPL.  A template comprises the following:

Text

Text is printed to the output as is.

Interpolation

Produces a calculated value in the output. Interpolations are delimited by ${ and }.

RPL tags

Instructions to RPL and will not be printed to the output. You use RPL tags to call directives. RPL tags are similar to HTML tags.

Comments

Comments are ignored by RPL  and are not written to the output. RPL comments are similar to HTML comments, but  are delimited by <#-- and -->.

In the following example, the template sections are highlighted so that you can easily see them. Comments are highlighted in blue, interpolations are highlighted in green, RPL tags are highlighted in yellow, and text is highlighted in gray. The [BR]’s indicate line breaks, and HTML tags are not highlighted (RPL reads HTML as text and does not interpret it in any way).

<html>[BR]

<head>[BR]

  <title>Welcome!</title>[BR]

</head>[BR]

<body>[BR]

  <#-- Greet the user by his/her name -->[BR]

  <h1>Welcome${profile.user}!</h1>[BR]

  <p>We have these animals:[BR]

  <ul>

  <#list animals as being>

    <li>${being.name}for${being.price}Euros</li>

  </#list>

  </ul>

</body>[BR]

</html> 

RPL distinguishes upper case and lower case letters. For example, ${name} is not the same as ${Name} or ${NAME}.

Keep in mind the following rules:

  • You can use interpolations only in text and in string literal expressions, described later in Interpolations.

  • You cannot place an RPL tag inside another RPL tag or inside an interpolation. For example, the following is incorrect:

<#-- Wrong code à

<#if <#include 'foo'>='bar'>...</#if>

  • You can place comments inside RPL tags and interpolations. For example:

<h1>Welcome ${user <#-- The name of user -->}!</h1>[BR]

<p>We have these animals:[BR]

<ul>[BR]

<#list <#-- some comment... --> animals as <#-- again... --> being>[BR]

... 

Next steps

Output

Most commonly used directives

Learn more

Interpolations

RPL Tags