|non

  • New in : SPIP 2.0

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

Examples:

[(#TITRE|strlen|>{30}|non) This title is a short one]
[(#EMAIL|non) #FORMULAIRE_SAISIE_EMAIL ]
[(#SET{my_table, #LISTE})]
[(#GET{my_table}|non) this table is empty]

Caution however:
Because it reproduces the behaviour of the PHP test if($var), the filter [(#VARIABLE|non)] will return « FALSE » (thus a space) 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}|non)] 

will display the optional part of the tag.
To test a variable including if it is equal to "0" (zero) we use:

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

See also

other test filters

logical filters

Footnotes

[1this can also be written as |not

Author Mark Published : Updated : 01/01/23

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