• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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