{if:variable} | {else:} |
HTML_Template_Flexy | |
PEAR Manual | |
Usage (
{end:}
)
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.
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:} |
The compiled template
<?php if ($t->showStuff) { ?>Hello<?php } ?> <?php if ($t->showDog()) { ?>Doggy<?php } ?> |
The output
Hello Doggy |
{if:variable} | {else:} |
HTML_Template_Flexy | |
PEAR Manual | |