Welcome Guest, Not a member yet? Register   Sign In
Extend Custom Controller?
#6

[eluser]cahva[/eluser]
Your mistake is the constructor.

Code:
class Admin extends Admin_Controller {
    
    function __construct() {
        parent::Controller();
    }

parent::Controller() is wrong as you will need to use parent::Admin_Controller(). Better yet, use PHP 5 style(as you are already doing with the __construct()
Code:
class Admin extends Admin_Controller {
    
    function __construct() {
        parent::__construct();
    }

And by the way, using MY_Controller is not needed at all. Just create your base controllers that extend Controller. So get rid of MY_Controller and just create Admin_Controller like this:
Code:
class Admin_Controller extends Controller {
    
    function __construct() {
        parent::__construct();
        
        if (!$this->ion_auth->is_admin()){
            $this->session->set_flashdata('message', 'You must be an admin to view this page');
            redirect('welcome/index');
        }

    }
}


Messages In This Thread
Extend Custom Controller? - by El Forum - 10-06-2010, 05:02 AM
Extend Custom Controller? - by El Forum - 10-06-2010, 06:28 AM
Extend Custom Controller? - by El Forum - 10-06-2010, 10:52 PM
Extend Custom Controller? - by El Forum - 10-07-2010, 05:52 AM
Extend Custom Controller? - by El Forum - 10-07-2010, 02:22 PM
Extend Custom Controller? - by El Forum - 10-07-2010, 03:38 PM
Extend Custom Controller? - by El Forum - 10-07-2010, 03:40 PM
Extend Custom Controller? - by El Forum - 10-07-2010, 03:53 PM
Extend Custom Controller? - by El Forum - 10-07-2010, 03:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB