Here is the templating mechanism i am used in my CI application
public function index($page = 'login')
{
$this->load->view('admin/header',array('page'=>$page));
$this->load->view('admin/pages/'.$page,$this->data);
$this->load->view('admin/footer');
}
I need to add a css class to current page ,for that i am using the following way in my header.php file
1.Pass the page name to the header view
and in header.php
<li class="<?php if($page=='admin-home'):echo 'active'; endif; ?>"><a href="<?=base_url()?>home/index/admin-home">Home</a></li>
<li class="<?php if($page=='all-users'):echo 'active'; endif; ?>"><a href="<?=base_url()?>home/index/admin-home">Users</a></li>
But i don't its a better way is there any other way to do this efficiently??