• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Admin module

#11
[eluser]Mauricio de Abreu Antunes[/eluser]
Nunca usei, mas tem vários sites falando sobre e bem documentados.

I've never used but therer are several sites talking about it and with large documentation.

#12
[eluser]Cálcio[/eluser]
Ok, I'll try found it later. I'm studying too Yii framework.

#13
[eluser]pickupman[/eluser]
Codeigniter does not include any controllers, other than the simple "Hello world" welcome.php controller. An admin controller is probably used on any application, but how many would every been the same. My guess is zero.

You can make an admin controller as easy as:
Code:
class Admin extends CI_Controlelr{

  public function __construct()
  {
    parent::__construct();
    $this->load->library('auth_library');

    if ( ! $this->auth_library->is_admin() )
    {
       redirect('login');
    }
  }
}

//Routes
$route['admin/(:any)/(:any)'] = '$1_admin/$2'; // admin/blog/index => blog_admin/index
$route['admin/(:any)']        = 'admin/$1';    // admin/index      => admin/index
$route['admin']               = 'admin/index'; // admin            => admin/index

I like to create an admin controller for each module/controller, so you don't end up with some large Admin controller. Again, this allows you to create a frontend & backend controllers you can move to different projects. I use the admin controller for only the "dashboard" part of the backend.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.