Welcome Guest, Not a member yet? Register   Sign In
Extending a controller with __construct not working
#1

[eluser]flaky[/eluser]
I don't know how to ask better so I'll try to be as clear as possible

I'm using HMVC and Template Library

I have this controller which I want every other controller to extend, I know I could have used MY_Controller, but I prefer it this way.

Path of main.php - /system/application/controllers/main.php
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

class Main extends Controller{
    
    public function Main(){
        parent::Controller();
        
        $this->output->enable_profiler(TRUE);
    }
    
    public function index(){
    }
    
}

An example of another controller extending the Main controller

path of user.php - /system/application/modules/user/controllers/user.php
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

require_once(BASEPATH . 'application/controllers/main' . EXT);

class User extends Main{
    
    public function User(){
        parent::Main();
    }
    
    public function index(){
    }

}

As you can see from sample code, like this it works without a problem, but the moment I change the constructors to "__construct()" it is just giving me the 500 error.

I just want to make my app as PHP5 friendly as possible. Is there a solution to this (which I'm not aware of) ?.

Thanks in advance.


Messages In This Thread
Extending a controller with __construct not working - by El Forum - 12-21-2009, 10:40 AM
Extending a controller with __construct not working - by El Forum - 12-21-2009, 11:58 AM
Extending a controller with __construct not working - by El Forum - 12-21-2009, 01:50 PM
Extending a controller with __construct not working - by El Forum - 12-21-2009, 02:12 PM
Extending a controller with __construct not working - by El Forum - 12-21-2009, 07:47 PM
Extending a controller with __construct not working - by El Forum - 12-21-2009, 09:54 PM
Extending a controller with __construct not working - by El Forum - 12-22-2009, 12:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB