Welcome Guest, Not a member yet? Register   Sign In
Construct errors
#1

[eluser]toadi[/eluser]
It seems that I can't find the error. I just try to setup a controller that checks if I'm logged in. If logged in I see the home view else I go to create user page.

But I have problems with the contructs. I'm a bit baffled about CI's implementation of PHP5 and PHP4. Don't really get it how to do it in CI.


MY_Controller.php
Code:
Class MY_Controller extends Controller
{
    
    function __construct()
    {
        parent::Controller;
        
        
    }
        
    
}

class Auth_Controller extends MY_Controller
{
    
    function __construct()    
    {
        parent::MY_Controller;
        
        $this->load->library('Ion_auth');

        if (!$this->ion_auth->loggedin())
        {
            header('Location: /auth/create_user');
        }
        
    }
}

Home.php
Code:
if (! defined('BASEPATH')) exit('No direct script access');

class Home extends Auth_Controller {


    function __construct()
    {
          parent::Auth_Controller();
    
    }
    
    function index() {
        
    $this->load->view('home');
    
    }

}

The error:

Code:
Fatal error: Call to undefined method Auth_Controller::Auth_Controller() in /Applications/MAMP/htdocs/simpleBI/system/application/controllers/home.php on line 10


Messages In This Thread
Construct errors - by El Forum - 03-17-2010, 05:23 PM
Construct errors - by El Forum - 03-17-2010, 06:18 PM
Construct errors - by El Forum - 03-18-2010, 02:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB