ecco($condition, $a, $b = null)
Echos one of two alternatives depending on a condition
-
$condition (mixed)
-
$a (mixed)
Echoed if $condition is true -
$b (mixed)
Echoed if $condition is false
Example
With two options
ecco(1 == 2, 'hell freezes over', 'everything is ok');
// will most definitely echo 'everything is ok'
With a single option
<ul>
<?php foreach($pages as $p): ?>
<li<?php ecco($p->isActive(), ' class="active"') ?>>
…
</li>
<?php endforeach ?>
</ul>