Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Basics

Operators

...

OperatorMeaningWorkSyntax (forse togliamo questa colonna?)
==equals(tick)

It is possible use this operator with dynamic fields 'as is' only to compare strings.

Code Block
languagexml
{% if dynamicfields.name == 'goofy' %} 
goofy
{% elsif dynamicfields.name == 'mickey' %}
mickey
{% else %}
donald
{% endif %}

In this case the check is case sensitive.

To compare numbers or data type different from string it is possible use the built in functions:

Code Block
languagexml
{% assign c1 = dynamicfields.name| evaltext: 'equalTo', 'Jennifer' %} {% if c1 == true %} Text {% endif %}
Code Block
languagexml
{% assign c1 = dynamicfields.age | evalinteger: 'equalTo', '8' %} {% if c1 == true %} Text {% endif %}
!=does not equal(tick)

It is possible use this operator with dynamic fields 'as is' only to compare strings.

Code Block
languagexml
{% if dynamicfields.name != 'goofy' %} 
goofy
{% elsif dynamicfields.name != 'mickey' %}
mickey
{% else %}
donald
{% endif %}

In this case the check is case sensitive.

To compare numbers or data type different from string it is possible use the built in functions:

Code Block
languagexml
{% assign c1 = dynamicfields.name| evaltext: 'otherThan', 'Jennifer' %} {% if c1 == true %} Text {% endif %}
Code Block
languagexml
{% assign c1 = dynamicfields.age | evalinteger: 'otherThan', '8' %} {% if c1 == true %} Text {% endif %}
>greater than(tick)

It is possible use this operator with dynamic fields 'as is' only to compare strings.

Code Block
languagexml
{% if dynamicfields.name > 'goofy' %} 
goofy
{% elsif dynamicfields.name > 'mickey' %}
mickey
{% else %}
donald
{% endif %}

In this case the check is case sensitive.

To compare numbers or data type different from string it is possible use the built in functions:

Code Block
languagexml
{% assign c1 = dynamicfields.name| evaltext: 'moreThan', 'Jennifer' %} {% if c1 == true %} Text {% endif %}
Code Block
languagexml
{% assign c1 = dynamicfields.age | evalinteger: 'moreThan', '8' %} {% if c1 == true %} Text {% endif %}
<less than(tick)

It is possible use this operator with dynamic fields 'as is' only to compare strings.

Code Block
languagexml
{% if dynamicfields.name < 'goofy' %} 
goofy
{% elsif dynamicfields.name < 'mickey' %}
mickey
{% else %}
donald
{% endif %}

In this case the check is case sensitive.

To compare numbers or data type different from string it is possible use the built in functions:

Code Block
languagexml
{% assign c1 = dynamicfields.name| evaltext: 'lessThan', 'Jennifer' %} {% if c1 == true %} Text {% endif %}
Code Block
languagexml
{% assign c1 = dynamicfields.age | evalinteger: 'lessThan', '8' %} {% if c1 == true %} Text {% endif %}
>=greater than or equal to(tick)

It is possible use this operator with dynamic fields 'as is' only to compare strings.

Code Block
languagexml
{% if dynamicfields.name >= 'goofy' %} 
goofy
{% elsif dynamicfields.name >= 'mickey' %}
mickey
{% else %}
donald
{% endif %}

In this case the check is case sensitive.

To compare numbers or data type different from string it is possible use the built in functions:

Code Block
languagexml
{% assign c1 = dynamicfields.name| evaltext: 'equalOrMoreThan', 'Jennifer' %} {% if c1 == true %} Text {% endif %}
Code Block
languagexml
{% assign c1 = dynamicfields.age | evalinteger: 'equalOrMoreThan', '8' %} {% if c1 == true %} Text {% endif %}
<=less than or equal to(tick)

It is possible use this operator with dynamic fields 'as is' only to compare strings.

Code Block
languagexml
{% if dynamicfields.name <= 'goofy' %} 
goofy
{% elsif dynamicfields.name <= 'mickey' %}
mickey
{% else %}
donald
{% endif %}

In this case the check is case sensitive.

To compare numbers or data type different from string it is possible use the built in functions:

Code Block
languagexml
{% assign c1 = dynamicfields.name| evaltext: 'equalOrLessThan', 'Jennifer' %} {% if c1 == true %} Text {% endif %}
Code Block
languagexml
{% assign c1 = dynamicfields.age | evalinteger: 'equalOrLessThan', '8' %} {% if c1 == true %} Text {% endif %}
orlogical or(tick)
Code Block
languagexml
{% if dynamicfields.name == 'goofy' or dynamicfields.age == 'child' %} 
is goofy or a child
{% else %}
It is an adult goofy or another adult
{% endif %}
andlogical and(tick)
Code Block
languagexml
{% if dynamicfields.name == 'goofy' and dynamicfields.age == 'child' %} 
goofy is a child
{% else %}
it is an adult
{% endif %}
containschecks for the presence of a substring inside a string(tick)
Code Block
languagexml
{% if dynamicfields.name contains 'oof' %} 
could be goofy? 
{% else %} 
surely isn't goofy 
{% endif %}

...

OperatorMeaningWorkSyntax
commentAny text within the opening and closing comment blocks will not be output, and any Liquid code within will not be executed Yes {% comment %} Text {% endcomment %}

...

Executes a block of code
OperatorMeaningWorkSyntax
if

Executes a block of code only if a certain condition is true

Yes
Code Block
languagexml
{% assign c1 = dynamicfields.nameage| evaltextevalinteger: 'equalTo', 'Jennifer10' %} 
{% if c1 == true %} 
10 years Textold 
{% endif %}
Code Block
languagexml
{% if dynamicfields.name == 'goofy' %} 
goofy
{% elsif dynamicfields.name == 'mickey' %}
mickey
{% else %}
donald
{% endif %}
unless
endif %}
unlessExecutes a block of code only if a certain condition is not me matchYes 
Code Block
{% assign c1 = dynamicfields.
name
age|
evaltext
 evalinteger: 'equalTo', '
Jennifer
10' %} 
{% unless c1 == true %}
Text
 
Not 10 years old
{% endunless %}
elsif/elseAdds more conditions within an 
Code Block
languagexml
{% unless dynamicfields.name == 'goofy' %} 
goofy
{% endunless %}
elsif/elseAdds more conditions within an if or unless block.   
Code Block
case/whenCreates a switch statement to compare a variable with different values 
languagexml
{% if dynamicfields.name == 'goofy' %} 
goofy
{% elsif dynamicfields.name == 'mickey' %}
mickey
{% else %}
donald
{% endif %}
case/whenCreates a switch statement to compare a variable with different values 
Code Block
{% case dynamicfields.name %}
 {% when 'goofy' %}
 This is goofy
 {% when 'mickey' %}
 This is mickey
 {% else %}
 This is not goofy nor a mickey. Maybe is donald.
{% endcase %}

Iteration

TBD

Variable

TBD

Filters

...

OperatorMeaningWorkSyntax
abs

Returns the absolute value of a number.

(error) 
append

Concatenates two strings and returns the concatenated value.

(tick)
Code Block
titleInput
{{ "Hello " | append: "Carl" }}
Code Block
titleOutput
Hello Carl

 

 

Code Block
titleInput
{{ "Welcome" | append: dynamicfields.name }}
Code Block
titleOutput
Welcome Luke 



Code Block
titleInput
{{ dynamicfields.name | append: " welcome!"}}
Code Block
titleOutput
Luke welcome!
at_least

Limits a number to a minimum value.

(error) 
at_most

Limits a number to a maximum value.

(error) 
capitalize

Makes the first character of a string capitalized.

(tick)
Code Block
titleInput
{{ "my great title" | capitalize }}
Code Block
titleOutput
My great title

 

 

Code Block
titleInput
{{ dynamicfields.nome | capitalize }}
Code Block
titleOutput
Luke
ceil

Rounds the input up to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.

(error) 
compact

Removes any nil values from an array.

  
concat

Concatenates (joins together) multiple arrays. The resulting array contains all the items from the input arrays.

(error) 
dateConverts a timestamp into another date format. The format for this syntax is the same as strftime. The input uses the same format as Ruby’s Time.parse.  
defaultAllows you to specify a fallback in case a value doesn’t exist. defaultwill show its value if the left side is nilfalse, or empty.(error) 
divided_by

Divides a number by the specified number.

(warning)

Does not work on dynamicfields.

 

Code Block
titleInput
{{ 16 | divided_by: 4 }}
Code Block
titleOutput
4

 

 

Code Block
titleInput
{{ subTotal| divided_by: 4 }}
Code Block
titleOutput
100
downcase

Makes each character in a string lowercase. It has no effect on strings which are already all lowercase.

(tick)
Code Block
titleInput
{{ "Parker Moore" | downcase }}
Code Block
titleOutput
parker moore

 

 

Code Block
titleInput
{{ dynamicfields.nome | downcase}}
Code Block
titleOutput
luke
escape

Escapes a string by replacing characters with escape sequences (so that the string can be used in a URL, for example). It doesn’t change strings that don’t have anything to escape.

(error) 
escape_once

Escapes a string without changing existing escaped entities. It doesn’t change strings that don’t have anything to escape.

(error) 
first

Returns the first item of an array.

 

Assuming the userid dynamicfield contains "1,2,3,4,5".

Code Block
titleInput
{% assign my_array = dynamicfields.userid | split: "," %}
{{ my_array.first }}
Code Block
titleOutput

 

 

Code Block
titleInput
{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}
{{ my_array.first }}
Code Block
titleOutput
apples
floor

Rounds a number down to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.

(error)

 

join

Combines the items in an array into a single string using the argument as a separator.

(tick)

Assuming the userid dynamicfield contains "1,2,3,4,5".

 

Code Block
titleInput
{% assign my_array = dynamicfields.userid | split: "," %}
{{ my_array | join: " and " }} 
Code Block
titleOutput
1 and 2 and 3 and 4 and 5

 

 

Code Block
titleInput
{% assign beatles = "John, Paul, George, Ringo" | split: ", " %}
{{ beatles | join: " and " }} 
Code Block
titleOutput
John and Paul and George and Ringo
last

Returns the last item of an array.

(tick)

Assuming the userid dynamicfield contains "1,2,3,4,5".

Code Block
titleInput
{% assign my_array = dynamicfields.userid | split: "," %}
{{ my_array.last}}
Code Block
titleOutput
5

 

 

Code Block
titleInput
{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}

{{ my_array.last }}
Code Block
titleOutput
plums
lstrip

Removes all whitespaces (tabs, spaces, and newlines) from the beginning of a string. The filter does not affect spaces between words.

(error)TODO: dovrebbe funzionare
map

Creates an array of values by extracting the values of a named property from another object.

 

 

minus

Subtracts a number from another number.

(warning)

Does not work on dynamicfields.

Code Block
titleInput
{{ 4 | minus: 2 }}
Code Block
titleOutput
2

 

 

 

Code Block
titleInput
{{ SubTotal | minus: 100 }}
Code Block
titleOutput
900
modulo

Returns the remainder of a division operation.

(warning)

Does not work on dynamicfields.

 

Code Block
titleInput
{{ 3 | modulo: 2 }}
Code Block
titleOutput
1

 

 

Code Block
titleInput
{{ SubTotal | modulo: 6}}
Code Block
titleOutput
4
newline_to_br

Replaces every newline (\n) with an HTML line break (<br>).

(error) 
plus

Adds a number to another number.

(tick)

Assuming the TotalIncome dynamic field contains 500.

Code Block
titleInput
{{ dynamicfields.TotalIncome| plus: 2 }}
Code Block
titleOutput
502

 

 

 

Code Block
titleInput
{{ 5| plus: 2 }}
Code Block
7
prepend

Adds the specified string to the beginning of another string.

(tick)
Code Block
titleInput
{{ "apples, oranges, and bananas" | prepend: "Some fruit: " }}
Code Block
titleOutput
Some fruit: apples, oranges, and bananas

 

 

Code Block
titleInput
{{ dynamicfields.Name| prepend: "Hello " }}
Code Block
titleOutput
Hello Luke

 

 

 

Code Block
titleInput
{{ dynamicfields.Name| prepend: dynamicfields.Surname}}
Code Block
titleOutput
Luke Skywalker

 

 

 

Code Block
titleInput
{{ "Welcome" | prepend: dynamicfields.Name }}
Code Block
titleOutput
Welcome Luke
remove

Removes every occurrence of the specified substring from a string.

 
Code Block
titleInput
{{ "I strained to see the train through the rain" | remove: "rain" }}
Code Block
titleOutput
I sted to see the t through the 

 

 

 

Code Block
titleInput
{{ dynamicfields.Name| remove: "uk"}}
Code Block
titleOutput
Le

 

 

Code Block
titleInput
{{"Luke Skywalker" | remove: dynamicfields.Name}}
Code Block
titleOutput
Skywalker
remove_first

Removes only the first occurrence of the specified substring from a string.

(tick)
Code Block
titleInput
{{ "I strained to see the train through the rain" | remove_first: "rain" }}
Code Block
titleOutput
I sted to see the train through the rain
replace

Replaces every occurrence of an argument in a string with the second argument.

(tick)
Code Block
titleInput
{{ "Take my protein pills and put my helmet on" | replace: "my", "your" }}
Code Block
titleOutput
Take your protein pills and put your helmet on

 

 

TODO: aggiungere esempi con campi dinamici!

replace_first

Replaces only the first occurrence of the first argument in a string with the second argument.

(tick) 
reverse

Reverses the order of the items in an array. reverse cannot reverse a string.

(error) 
round

Rounds an input number to the nearest integer or, if a number is specified as an argument, to that number of decimal places.

(tick) 
rstrip

Removes all whitespace (tabs, spaces, and newlines) from the right side of a string.

(error)TODO: dovrebbe funzionare
size

Returns the number of characters in a string or the number of items in an array. size can also be used with dot notation (for example, {{ my_string.size }}). This allows you to use size inside tags such as conditionals.

(tick) 
slice

Returns a substring of 1 character beginning at the index specified by the argument passed in. An optional second argument specifies the length of the substring to be returned.

String indices are numbered starting from 0.

(tick) 
sort

Sorts items in an array by a property of an item in the array. The order of the sorted array is case-sensitive.

(warning) 
sort_naturalSorts items in an array by a property of an item in the array.  
splitDivides an input string into an array using the argument as a separator. split is commonly used to convert comma-separated items from a string to an array.(tick) 
strip

Removes all whitespace (tabs, spaces, and newlines) from both the left and right side of a string. It does not affect spaces between words.

(error)TODO: dovrebbe funzionare
strip_html

Removes any HTML tags from a string.

  
strip_newlines

Removes any newline characters (line breaks) from a string.

  
times

Multiplies a number by another number.

(warning) 
truncate

truncate shortens a string down to the number of characters passed as a parameter. If the number of characters specified is less than the length of the string, an ellipsis (…) is appended to the string and is included in the character count.

(tick) 
truncatewords

Shortens a string down to the number of words passed as the argument. If the specified number of words is less than the number of words in the string, an ellipsis (…) is appended to the string.

(warning)TODO: dovrebbe funzionare
uniq

Removes any duplicate elements in an array.

(error) 
upcase

Makes each character in a string uppercase. It has no effect on strings which are already all uppercase.

(tick)
Code Block
titleInput
{{ dynamicfields.name | upcase }}

Code Block
titleOutput
{{ dynamicfields.name | upcase }}
url_decode

Decodes a string that has been encoded as a URL or by url_encode.

(error) 
url_encode

Converts any URL-unsafe characters in a string into percent-encoded characters.

(error) 

...