PEAR Manual
Prev |  | Next

# {end:}

{end:} -- closes an if or foreach block

## Synopsis

``Usage` ({end:})`

## Description

adds a closing brace in PHP so that blocks of conditional HTML are shown correctly. You do not need to use {end:} tags if you are using HTML tag attributes like IF="a,b", as the closing HTML tag will indicate that.

## Example

Example 41-1. Setting variables for if
    class example {
        function showDog() {
            return true;
        }

        function output() {

            $this->showStuff = true;

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

Example 41-2. The template
    {if:showStuff}Hello{end:}
    {if:showDog()}Doggy{end:}

Example 41-3. The compiled template
    <?php if ($t->showStuff)  { ?>Hello<?php } ?>
    <?php if ($t->showDog()) {  ?>Doggy<?php } ?>

Example 41-4. The output
    Hello
    Doggy

Prev | Home | Next
{if:variable} | Up | {else:}