codeigniter admin template

3k Views Asked by At

Hello all im using this template system http://williamsconcepts.com/ci/codeigniter/libraries/template/index.html

but now i want to add a admin system to it, how would you do that?

make a map in controller/model and view calling "admin" but how can i then use the template system without conflicts :O?.

do you know a better way i will be glad if you will tell :)

Thanks a lot

2

There are 2 best solutions below

0
On BEST ANSWER

Yes, you can create a view called admin and a controller called admin; there will be no conflicts.

Using a template library, you will want to do something like this:

In config/template.php

$template['admin']['template'] = 'admin/admin_template.php'; // in your views

// create a new template and its regions 
$template['admin']['regions'] = array(
  'header',
  'content',
  'footer',
);

then in your admin controller:

class Admin extends CI_Controller { //ci 2.0

  function __construct()
  {
      parent::__construct();
      $this->load->library('template');
      $this->template->set_template('admin'); // set the admin template
  }

  // carry on as normal
}
1
On

i set up my routes to go through /admin and the actions that are for admins are in /views/admin/modelname

I also use tankAuth it's very good.