{null}

The constant NULL: its content is dropped, the @else@ part too, and a null= option fires.

Conditions Either form

Syntax

{null}
{null} ... {/null}
{null null='name'} ... {/null}

Description

{null} answers NULL, the level's third state next to the hit of {true} and the else of {false}. In the null state nothing of the pair renders: not the content and not its @else@ part either. Alone it prints nothing.

What a NULL does fire is the null='name' option every tag takes: the stored {content} of that name renders in the level's place. An else= option does not fire on NULL - it is kept for FALSE, an empty list and an empty text. A tag of your own (or a PHP call) that answers NULL for "there is no such thing" therefore has its own way out, separate from "there is something, and it is empty".

The engine reads NAN as NULL too; INF, a float past the range, is a value and prints. {null} is mainly there to show and test that difference, and to switch a block off so thoroughly that even its else part stays away.

Examples

Three states side by side

The @else@ part renders for {false} but not for {null}.

Templateexamples/null/1-states.pad
<ul>
  <li>true: {true}content@else@else part{/true}</li>
  <li>false: {false}content@else@else part{/false}</li>
  <li>null: {null}content@else@else part{/null}</li>
</ul>
Resultopen alone
  • true: content
  • false: else part
  • null:

null= and else=

A NULL fires the null= option and leaves else= alone.

Templateexamples/null/2-option.pad
{content 'nullMissing'}<em>no such thing</em>{/content}
{content 'nullEmpty'}<em>empty</em>{/content}
<p>null with null=: {null null='nullMissing'}x{/null}</p>
<p>null with else=: {null else='nullEmpty'}x{/null}</p>
<p>false with else=: {false else='nullEmpty'}x{/false}</p>
Resultopen alone

null with null=: no such thing

null with else=:

false with else=: empty

See also

  • {true} The constant TRUE: its content renders once, as a level of its own.
  • {false} The constant FALSE: its content is skipped and its @else@ part renders instead.
  • {content} Keeps a piece of template under a name instead of printing it, for a later {name} to render.