Open argigentarna opened 6 years ago
Hai, my name is Argi. Please I Need Help.
I use this in Codeigniter. But In sidebar menu when i click the other menu, the li menu not active
This my code :
<?php $main=$this->db->get_where('tabel_menu_admin',array('parent'=>0))->result(); foreach ($main as $m ){ // chek ada submenu atau tidak $sub=$this->db->get_where('tabel_menu_admin',array('parent'=>$m->menu_id)); if($sub->num_rows()>0){ // looping submenu echo "<li><a href='javascript:void(0);' class='menu-toggle'> <i class='material-icons'>assignment</i> <span>"; echo strtoupper($m->nama_menu); // echo anchor('javascript:void(0);', '<i class="menu-toggle"></i> <span>'.strtoupper($m->nama_menu).' </span></i>'); echo "</span></a><ul class='ml-menu'>"; foreach ($sub->result() as $s){ echo '<li>'.anchor('admin/'.$s->link,' <i class="material-icons">'.$s->icon.'</i> <span>'.strtoupper($s->nama_menu)).'</span></li>'; } echo "</ul>"; echo "</li>"; }else{ // echo '<li>'.anchor('admin/'.$m->link,' <i class="'.$m->icon.'"></i> <span>'.strtoupper($m->nama_menu)).'</span></li>'; echo '<li>'.anchor('admin/'.$m->link,' <i class="material-icons">'.$m->icon.'</i> <span>'.strtoupper($m->nama_menu)).'</span></li>'; } }?>
Thanks for attention
Hello,
You need to add class='active' to your parent li and the child for every page.
class='active'
Hai, my name is Argi. Please I Need Help.
I use this in Codeigniter. But In sidebar menu when i click the other menu, the li menu not active
This my code :
Thanks for attention