1.0 1.1 1.2 1.3

Checks whether a variable is not null

template(string $name [, array $rest = array() ])

Also see {load_templates} that allow to load multiple templates from one file much like you include functions/classes from an external file in php.

Recursive menu example

With $menuTree being this array:

$menuTree = array(
  array('name'=>'Foo', 'children'=>array(
    array('name'=>'Foo-Sub', 'children'=>array()),
    array('name'=>'Foo-Sub2', 'children'=>array()),
  array('name'=>'Bar', 'children'=>array()), 
  array('name'=>'Baz', 'children'=>array()), 
{template menu data tick="-" indent=""}
  {foreach $data entry}
    {$indent}{$tick} {$entry.name}<br />
    {if $entry.children}
      {* recursive calls are allowed which makes subtemplates especially good to output trees *}
      {menu $entry.children $tick cat("&nbsp;&nbsp;", $indent)}

{menu $menuTree ">"}
> Foo
  > Foo-Sub
  > Foo-Sub2
> Bar
> Baz