Liquid tags
Tags create the logic and control flow for templates. They are denoted by curly braces and percent signs: {% and %}.
Tags are really powerful and are used extensively in document layouts in Current RMS. They’re a way of performing logic operations and controlling flow in document layouts.
Liquid syntax is used in other web apps, so resources online might make reference to tags that aren't supported in Current.
comment
comment
Any content that you put between {% comment %}
and {% endcomment %}
tags is turned into a comment.
if
/else
/elsif
if
/else
/elsif
Use an if
tag to determine whether content should be shown if a certain condition is true.
For example, you can check to see if a customer’s telephone number is blank and display a different message by adding a {% else %}
depending on whether or not this is true.
Use elsif
to add more conditions. For example:
unless
unless
An unless
tag is the opposite of an if
tag. It tells Current RMS to only show content if the condition isn’t met.
for
for
for
loops run through items in a collection (array), e.g. opportunity items or contacts against an organisation.
In the example below, a list item is created for each item within the order.items
loop – this is the list of items on an opportunity:
This might output something like:
ETC Source 4
Martin Mac Entour
Pioneer XDJ
Apple MacBook Pro
cycle
cycle
The cycle tag is used within a for
loop. It’s a way of looping through a group of strings and outputting them in the order they were listed.
For example, we could run through order.items
as above but have every other list item as italicized or bold:
This might output something like:
ETC Source 4
Martin Mac Entour
Pioneer XDJ
Apple MacBook Pro
assign
assign
Use assign
to create a variable. Variables are used to store information that you can reference and manipulate later.
For example:
Use quotation marks to save as a string:
capture
capture
Use capture
to capture something between the opening and closing tags and assign to a variable. Variables that you create are stored as strings.
{{ hello_message }}
will then output something like:
case
case
Creates a switch statement to compare a variable with different values. case
initializes the switch statement, and when
compares its values.
Last updated