Active menu tabs with codeigniter

前端 未结 4 1914
故里飘歌
故里飘歌 2021-02-10 10:46

Which method can be used in Codeigniter to achieve active menu tabs?

For example I have a user menu Profile Friends Messages Logout

When I\'m in th

4条回答
  •  盖世英雄少女心
    2021-02-10 11:33

    There is a simple example how to create controller based active menu.

       $ci =& get_instance();
    
       // get the current controller
       $controller = $ci->router->fetch_class(); 
    
       // you can generate this array dynamically
       $resources = array(0 => array("controller" => "home", "title" => "Home"),
                          1 => array("controller" => "products", "title" => "Products"),
                          2 => array("controller" => "services", "title" => "Services"),
             );
       
    

    Of course, you can create more complex navigation menu based on both controllers and methods.

提交回复
热议问题