Hasan Setiawan

Write, write, write give your wings on code!

Follow me on GitHub

Codeigniter pass data in multiple view

CodeIgniter will intelligently handle multiple calls to $this->load->view() from within a controller. If more than one call happens they will be appended together. For example, you may wish to have a header view, a menu view, a content view, and a footer view. That might look something like this:

      
        class Page extends CI_Controller {

              public function index()
              {
                      $data['page_title'] = 'Your title';
                      $this->load->view('header');
                      $this->load->view('menu');
                      $this->load->view('content', $data);
                      $this->load->view('footer');
              }

        }