Hothi Jimit Hothi Jimit - 2 years ago 90
PHP Question

How to customize master template concept in codeigniter 3.0?

I am new in Codeigniter 3.0. So master page concept how used in Codeigniter 3.

I want to make the admin panel master page so I don't rewrite header, footer code. I also want to customize the title.

How to do it?

Answer Source

First I would create something like this below in a controller. You can set your content page in a variable like below and then pass it to your admin template. Like in the example view. Just a example below though.


class Welcome extends CI_Controller {

   public function index() {
      // You should be able to pass data as normal

      $data['title'] = 'Welcome to CodeIgniter';

      $data['template_page'] = 'common/dashboard'; // This dashboard would be name of a view and common name a folder.

      $this->load->view('admin_template', $data);







Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download