Active menu tabs with codeigniter

前端 未结 4 1918
故里飘歌
故里飘歌 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:37

    I had the same issue . Here is my solution:

    In each of the controllers, add a parameter in the function

    $data['activeTab'] == "profile";
    $this->load->view('viewname',$data); (Profile controller)
    
    $data['activeTab'] == "friends";
    $this->load->view('viewname',$data); (Friends controller)
    
    $data['activeTab'] == "messages";
    $this->load->view('viewname',$data); (Messages controller)
    

    In the view where you have the navigation bar,add a code something like this :

    
    

    This should solve the problem. Tell me if the problem persists.

    Thanks

提交回复
热议问题