CodeIgniter Forums
HTML helper: adding classes to li using ul() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: HTML helper: adding classes to li using ul() (/showthread.php?tid=33814)



HTML helper: adding classes to li using ul() - El Forum - 09-09-2010

[eluser]stef25[/eluser]
I'm using the HTML helper to print out the main navigation of my site in an unordered list. Is there any way I can add a class="active" to a list item?

If
Code:
$this->uri->segment(2) == "red"
I'd like to add class="active" to the html output for that element.


Code:
$list = array(
            'red',
            'blue',
            'green',
            'yellow'
            );