SPIP

[ar] [ast] [bg] [br] [ca] [co] [cpf] [cs] [da] [de] [en] [eo] [es] [eu] [fa] [fon] [fr] [gl] [id] [it] [ja] [lb] [nl] [oc] [pl] [pt] [ro] [ru] [sk] [sv] [tr] [uk] [vi] [zh] Espace de traduction

Download

|is_null

November 2010

All the versions of this article:

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.


Show the template of this page Site powered by SPIP | Translation area | Private area