Welcome Guest, Not a member yet? Register   Sign In
Shouldn't CI load MY_ class automaticly?
#1

[eluser]FinalFrag[/eluser]
Well, the title says it all actually...

I have made a library like this:
Code:
class MY_Controller extends Controller {
    function MY_Controller() {
        parent::Controller();
    }
    
    function getMyList() {
        // do stuff here
    }
}

I should be able to do this in my controllers now:
Code:
class Home extend Controller {
    function Home() {
        parent::Controller();
        $this->getMyList();
        
        // etc...
    }
}

Or am I wrong? Should I extend 'Controller' or 'MY_Controller'?
#2

[eluser]xwero[/eluser]
You have to extend MY_Controller in the actual controllers. The function of the MY_Controller file is that it is included automatically. So you don't have to do
Code:
include(APPATH.'controllers/MY_Controller'.EXT);

class Home extend MY_Controller
{

}
#3

[eluser]FinalFrag[/eluser]
Ah, I knew there was something to be going on automaticly Smile

Thnx for the fast reply...




Theme © iAndrew 2016 - Forum software by © MyBB