Usage (
{else:}
)
adds an else statement in PHP so that blocks of conditional HTML are shown correctly.
Setting variables for if
class example {
function output() {
$this->showStuff = false;
.........
$template->outputObject($this);
}
}
Else in template
{if:showStuff}Hello{else:}World{end:}
Compiled template
<?php if ($t->showStuff) { ?>Hello<?php } else { ?>World<<?php } ?>
The output
World