How to create menu in codeigniter

        1. How to create menu in codeigniter
        2. At First set your base_url in config file (if not set).!

          sadanandkenganal/activelink_codeigniter.md

          #Add active class to menu in codeigniter

          In codeigniter, it’s very easy to add active class to the current menu in menu item.

          Follow the below steps.

          Step 1:- Create a file called "menu_helper.php" inside "application/helpers/menu_helper.php" and paste the below code.

          <?phpif(!defined('BASEPATH')) exit('No direct script access allowed'); if(!function_exists('active_link')) { functionactivate_menu($controller) { // Getting CI class instance.$CI = get_instance(); // Getting router class to active.$class = $CI->router->fetch_class(); return ($class == $controller) ?

          'active' : ''; } }?>

          Step 2:- Load above helper in your controller (go to controllers/yourcontrooller.php).

          Forum.codeigniter.com › showthread.

        3. Forum.codeigniter.com › showthread.
        4. I'm considering putting the menu options in a table and generating the menu dynamically from that table.
        5. At First set your base_url in config file (if not set).
        6. How to set a navigation menu and its links using PHP CodeIgniter, AJAX & jQuery s a video tutorial for beginners and intermediate users.
        7. Pass the menu to the $data['menu'] variable in the method you display your page view.
        8. OR Load above helper in .autoload (go to config/autoload.php and add below code).

          $this->load->helper('menu');

          Step 3 :-. Add class to your menu. pass your controller name in activate_menu() method.

          <li class="<?phpechoactivate_menu('home'); ?>"><a href="<?phpechosite_url();?>">Home</a></li> <li c