March 2019
Intermediate to advanced
412 pages
9h 49m
English
A filter is applied to a variable by way of the pipe symbol |, followed by the name of the filter, and then any arguments for the filter inside parentheses. There can be a space between the variable name and the pipe symbol, as well as a space between the pipe symbol and the filter name. For example, if we wanted to apply the lower filter (which makes all the characters lowercase) to the my_word variable, we would use the following syntax:
{{ my_word | lower }}
Because the lower filter does not take any arguments, it is not necessary to attach an empty parentheses set to it. If we use a different filter that requires arguments, this all changes. Let's use the replace filter, which allows us to replace all occurrences of a substring ...
Read now
Unlock full access