|is_null

A PHP function used as a filter and which is applied here to the #ENV variable. This is used to test for the existence of a particular variable in the SPIP environment.

It is sometimes necessary to differentiate between a variable that has "empty contents" and one which is actually "non-existent". This filter is here to help you. It is applied to the #ENV{thing} tag and makes it possible to test to see if the "thing" variable has been declared for the current template environment.

[(#ENV{thing}|is_null)]

This code returns "1" of the variable "thing" is null (i.e. non-existent) or nothing if it is not null (i.e. existent) [1].

This filter can not be applied to variables declared with #SET where the value is not present in the environment but only in the template.

Footnotes

[1Caution: not to get confused between the "null variable", which is non-existent, and an "empty variable", which does exist in the environment but which has no assigned value.

Author Mark Published : Updated : 22/04/23

Translations : English, français, Nederlands