previous{foreach:variable,key,value} (Previous) (Next) {end:}next

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

{if:variable}

{if:variable} – creates a PHP if statement

Synopsis

Usage ( {if:variable} , {if:method()} )

Description

creates an if statement, with the argument as a variable or method. You must close an if statement with an {end:} statement, and you may use {else:} with it.

Example

Setting variables for if

         

class example {
    function showDog() {
        return true;
    }

    function output() {
        
        $this->showStuff = true;
        
        .........
        $template->outputObject($this);
    }
}

The template

   

{if:showStuff}Hello{end:}
{if:showDog()}Doggy{end:}

Compiled template

         
      
<?php if ($t->showStuff)  { ?>Hello<?php } ?>
<?php if ($t->showDog()) {  ?>Doggy<?php } ?>

The output

         
      
Hello
Doggy
previous{foreach:variable,key,value} (Previous) (Next) {end:}next

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.