|oui

  • New in : SPIP 2.0

The |oui filter [1] returns either a space or nothing at all.
It is equivalent to |?{' ',''} , and is used to return a non-empty content (a space) to indicate that the optional parts of the tag should be displayed.

Examples:

[(#TITRE|strlen|>{30}|oui) This title is a long one]
[(#EMAIL|oui) #FORMULAIRE_CONTACT ]

However, please note :
Because it replicates the behaviour of the PHP if($var) test, the [(#VARIABLE|oui)] filter will return "FALSE" (i.e. nothing) if #VARIABLE is equal to "0" (zero) or is "null" or is not defined.

So with &a_variable =0 in url, writing

[(#ENV{a_variable}|oui)]

will return nothing.

To test a variable even if it is equal to "0" (zero) we use:

[(#ENV{a_variable}|strlen|oui)]

See also

Other test filters

logical filters

Footnotes

[1This can also be written as |yes

Author Mark Published : Updated : 08/07/23

Translations : català, English, Español, français, Nederlands