Skip to main content

Highlight the current page in a list menu by setting active class if page segment corresponds to menu item.

<ul>
  <li class="<?=($this->uri->segment(1)==='alfa')?'active':''?>"><a href="alfa/index" title="Alfa">Alfa</a></li>\
  <li class="<?=($this->uri->segment(1)==='beta')?'active':''?>"><a href="beta/index" title="Beta">Beta</a></li>
</ul>