Welcome Guest, Not a member yet? Register   Sign In
ul() and list items (li) style
#1

[eluser]SDSL[/eluser]
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

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

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

and into your views you can use it like this

Code:
&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.
#2

[eluser]Bainzy[/eluser]
cool nice snippet !




Theme © iAndrew 2016 - Forum software by © MyBB