Comparison filters

Just like the criteria used for loops, comparison filters can also be applied to tags with the following "pipe" syntax:

[(#TAG|operator{value})]

The list of applicable operators includes:

  • == (confirms equality)
  • !=
  • >
  • >=
  • <
  • <=

Example

[(#TITRE|=={Chocolate}|oui) 
    Some chocolate!
]
[(#TEXTE|strlen|>{200}|oui)
    This text is longer than 200 characters!
]

[(#TITRE|=={Chocolate}) Some chocolate!] would, if the test evaluates to true, display “1 Some chocolate!” (since 1 indicates a true value in PHP). But adding the |oui filter (French for yes) allows you to hide the results of the test.

Author Mark Baber Published : Updated : 19/06/10

Translations : English, français