PEAR Manual
Prev |  | Next

# {else:}

{else:} -- adds an PHP else in an if block

## Synopsis

``Usage` ({else:})`

## Description

adds an else statement in PHP so that blocks of conditional HTML are shown correctly.

## Example

Example 41-1. Setting variables for if
    class example {

        function output() {

            $this->showStuff = false;

            .........
            $template->outputObject($this);
        }
    }

Example 41-2. Else in template
    {if:showStuff}Hello{else:}World{end:}

Example 41-3. Compiled template
    <?php if ($t->showStuff)  { ?>Hello<?php } else { ?>World<<?php } ?>

Example 41-4. The output
    World

Prev | Home | Next
{end:} | Up | <FORM NAME="name"