CodeIgniter Forums

Full Version: ul() and list items (li) style
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hello, I wanted to use the ul() helper to generate tabs and for some reason i wanted to show selected tab/list_item
that lead me to modify the core codeigniter html_helper file include small modification that will allow me to set attributes to my list items

into /helper/html_helper.php
replace this line

$out .= str_repeat(" ", $depth + 2);
$out .= "<li>";

with this
$out .= str_repeat(" ", $depth + 2);
$key = is_int($key) ? "" : $key;
$out .= "<li ".$key.">";

and into your views you can use it like this

&lt;?=ul(array("class='on'"=>"First item", "2nd item","class='last'"=>"Last item"));?&gt;

hope it helps some one, I'd like not to overwrite the core files but to get fast solution I had to do it
i know it's not best way.

El Forum

cool nice snippet !