aid

Wednesday, 15 April 2015

Loading multiple views in CodeIgniter

Loading multiple views in CodeIgniter
CodeIgniter will astutely handle multiple calls of view, model in a controller  $this->load->view(‘viewname’) within a controller. If many call happen from a controller, view will be appended jointly. For example, If you have view and you want to load some header footer content section a view so you can do by the follow example:-


<?php

class mycontroller extends CI_Controller {

   function index()
   {
      $data[header] = ‘page header’;
      $this->load->view('header');
      $this->load->view('menu');
      $this->load->view('content', $data);
      $this->load->view('footer');
   }

}
?>

No comments:

Post a Comment