Welcome Guest, Not a member yet? Register   Sign In
MY_Controller problem
#1

[eluser]mcair[/eluser]
I am trying to use the constructor of MY_Controller as a gatekeeper. In a derived controller, I get the following message:

Fatal error: Class 'MY_Controller' not found in C:\LeagueManager\Site\system\application\controllers\leaguedisplay.php on line 3

related classes:

Code:
class MY_Controller extends Controller
{
    
function __construct()
{
    parent::Controller();
    if (!f_IsValidSessionValue('OwnerPublicId'))
        $this->load->view('auth/login_form');
}

Code:
class LeagueDisplay extends MY_Controller {
    
function __construct()
{
    parent::MY_Controller();
}
#2

[eluser]Phil Sturgeon[/eluser]
When you start mixing PHP 4 and PHP 5 style constructors you are gearing up for a headache. I'd set them all to PHP 4 style and see if that helps.
#3

[eluser]mcair[/eluser]
Thanks for the input. I tried a straight PHP4 approach, renaming the __Construct function to the same as the class, but have the same results.
#4

[eluser]jedd[/eluser]
Filename and location of your MY_Controller file please.
#5

[eluser]Phil Sturgeon[/eluser]
To confirm, you have:

Code:
class MY_Controller extends Controller
{
    
function MY_Controller()
{
    parent::Controller();
    if (!f_IsValidSessionValue('OwnerPublicId'))
        $this->load->view('auth/login_form');
}

in application/libraries/MY_Controller.php ?
#6

[eluser]mcair[/eluser]
Thank-you! I had placed my_controller in \Controllers. Moved it to Libraries and all is well. Thanks again.




Theme © iAndrew 2016 - Forum software by © MyBB