RPL Tags

Working with RPL tags

You use RPL tags to call directives. For example, the following code:

<#list animals as being>[BR]

    <li>${being.name} for ${being.price} Euros[BR]

  </#list>[BR]

calls the list directive.

There are two kind of RPL tags:

Start tag    
<#directivename parameters>

End tag
</#directivename>

This is similar to HTML or XML syntax, except that the RPL tag name begins with #. If the directive does not have any content between the start and end tags, you must use the start tag with no end tag. For example, <#if something>...</#if>, but just <#include something>.

There are two types of directives: predefined directives and user-defined directives. User-defined directives begin with @, for example <@mydirective parameters>, and predefined directives begin with #. One further difference is that if the directive has no nested content, you must use a tag such as  <@mydirective parameters />, similarly to XML (e.g. <img ... />). User-defined directives are described in more detail later in Defining your own directives.

RPL tags must be properly nested. For example, the following code is incorrect because the if directive is both inside and outside of the nested content of the list directive:

<ul>

<#list animals as being>

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

  <#if user == "Big Joe">

     (except for you)

</#list> <#-- WRONG! The "if" has to be closed first. -->

</#if>

</ul> 

Note that RPL does not care about the nesting of HTML tags because RPL reads HTML as flat text and does not interpret it in any way.

If you try to use a non-existing directive (e.g., you mistype the directive name), RPL will not process the template and produce an error message.

RPL ignores superfluous white space inside RPL tags. So you can write this:

<#list[BR]

  animals       as[BR]

     being[BR]

>[BR]

${being.name} for ${being.price} Euros[BR]

</#list    > 

You may not, however, insert white space between the < or </ and the directive name.

For a complete list and descriptions of predefined directives, see Directive Reference.

Learn more

Templates

Directive Reference