Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

is_null

Summary

Returns TRUE if the provided variable is NULL.

Usage

input|is_null( target )

Parameters

NameTypeDescriptionRequired
target any The target variable. Only if the input parameter is omitted.

Returns

TRUE or FALSE.

Description

This operator checks if the input parameter or the target variable is NULL. If it is, the operator will return TRUE, otherwise FALSE will be returned. If both the input parameter and the target variable are provided, it is the target variable that will be evaluated. Please note that an integer with a value of zero is not the same as NULL.

Examples

Example 1

{def $my_variable=3}
 
{if $my_variable|is_null()}
    It is NULL.
{else}
    It is not NULL.
{/if}

The following output will be produced: "It is not NULL.".

Example 2

{def $my_variable=3}
 
{if is_null( $my_variable )}
    It is NULL.
{else}
    It is not NULL.
{/if}

The following output will be produced: "It is not NULL.".

Example 3

{def $a=3
     $b='Mobile instrument.'}
 
{if $a|is_null( $b )}
    It is NULL.
{else}
    It is not NULL.
{/if}

The following output will be produced: "It is not NULL.".

Balazs Halasy (05/02/2004 12:34 pm)

Balazs Halasy (06/05/2005 7:25 am)


Comments

  • checking, if a textline has content

    {if $node.object.data_map.headline.has_content}
    <p class="headline">{attribute_view_gui attribute=$node.object.data_map.headline}</p>
    {/if}
  • checking, if an image has content

    {if $node.object.data_map.image.has_content}
    <p class="headline">{attribute_view_gui attribute=$node.object.data_map.headline}</p>
    {/if}
  • checking, if an XML Block has content

    {section show=$node.object.data_map.body.content.is_empty|not}
    {attribute_view_gui attribute=$node.object.data_map.body}
    {/section}
    • Re: checking, if an XML Block has content

      This is also used for ISBN
  • Checking if a matrix has content

    {section show=$node.object.data_map.xx.content.rows.sequential}
    {attribute_view_gui attribute=$node.object.data_map.xx}
    {/section}
  • Checking if a time-date field has content

    {section show=$node.object.data_map.xxtime.content.is_valid} {attribute_view_gui attribute=$node.object.data_map.xxtime}
    {/section}