How can I simplify this with less code?
<?php
$items['link1'] = 'Link 1';
$items['link2'] = 'LInk 2';
$items['link3'] = 'Link 3';
?>
<?php foreach ($items as $url => $text): ?>
<?php $class = false; if (isset($active) and $active == $url) $class = array('class' => 'current'); ?>
<?php echo '<li>' . Html::anchor($url, $text, $class) . '</li>' ?>
<?php endforeach; ?>
And also, for some reason the “current” class is not showing when on the particular URL.
Thanks
This is less code:
But since I don’t know what it’s supposed to do, I can’t really help beyond pretty-printing it for you. More details, please.