gurayyarar / AdminBSBMaterialDesign

AdminBSB - Free admin panel that is based on Bootstrap 3.x with Material Design
https://gurayyarar.github.io/AdminBSBMaterialDesign
MIT License
2.75k stars 1.55k forks source link

Sidebar li active not change #120

Open argigentarna opened 6 years ago

argigentarna commented 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

screen shot 2018-04-17 at 12 53 15

This my code :

  • home HOME
  •                 <?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

    dheroefic commented 6 years ago

    Hello,

    You need to add class='active' to your parent li and the child for every page.
    untitled