Welcome Guest, Not a member yet? Register   Sign In
Class MY_Controller not found
#1

[eluser]Mareshal[/eluser]
I am trying to extend the controller class with this code

Code:
//controllers/backend/dashboard.php

class Dashboard extends MY_Controller
{

    var $path = "backend/dashboard/";
    var $inc  = "backend/includes/";

    /**
    * Constructor
    */    
    function __construct()
    {
        parent::MY_Controller();
    }
}

Code:
//libraries/MY_Controller
class MY_Controller extends Controller {
    
    function __construct() {
        parent::Controller();
    }
}

What is wrong here? I read a few articles about this, but I fixed those issues. anything else?

I am using the CI version from BitBucket, could this be an issue?
#2

[eluser]Rob Gordijn[/eluser]
If I'm right, the bitbucket version is the latest 'CI 2.0 in development' version.
So my guess is that you have found the solution by yourself, your code is flawless.
#3

[eluser]Mareshal[/eluser]
That code doesn't work in CI 1.7.2 too Sad

LOL, not it works in 1.7.2 , very very strange
#4

[eluser]Rob Gordijn[/eluser]
ok, strange.
thoughts:

- are the filesnames correct? (i dont see .php in MY_Controller)
- are the files in the same project / application directory?
- use parent::__construct() instead of parent::MY_Controller(); in the Dashboard class
- errr, running out of clues...
#5

[eluser]Mareshal[/eluser]
The error is on this line

Code:
class Dashboard extends MY_Controller
{

MY_Controller has .php for sure, just checked

Yes, files are in same application, but I have this pattern:
/
dev
system
index.php

My application is on the same level with system folder, everything else works.

I tried with __construct already, but same code in 1.7.2 works, so there's a problem with 2.0. Just submitted an issue on BitBucket for this
#6

[eluser]Rob Gordijn[/eluser]
ok, last thought:

are you using some kind of extension, hooks, HMVC, custom code or others?

try a plain CI install, I use the MY_Controller exactly the same as you, and it just works.
#7

[eluser]Phil Sturgeon[/eluser]
There was a bug in the core of CodeIgniter 2.0 which would stop MY_Controller being loaded. It has been fixed in the latest "bleeding edge" copy, so just download it again.
#8

[eluser]Mareshal[/eluser]
[quote author="Phil Sturgeon" date="1269441699"]There was a bug in the core of CodeIgniter 2.0 which would stop MY_Controller being loaded. It has been fixed in the latest "bleeding edge" copy, so just download it again.[/quote]

Still not working. Here is the entire version CI core and my application, just download, and test on your localhost

Code:
http://dl.transfer.ro/codeigniter-transfer_ro-24mar-468eee07.rar

If anyone tests it, tell me please
#9

[eluser]Phil Sturgeon[/eluser]
Well, Greg Aker fixed it his way and I fixed it my way. Does my fork work better?

Also, it could be as you are requesting parent::MY_Controller(); which does not exist. Pick MY_Controller or __construct and use it consistently.
#10

[eluser]Mareshal[/eluser]
same same same. Sad(

I think I am going to switch back to 1.7.2 :|




Theme © iAndrew 2016 - Forum software by © MyBB