[eluser]Référencement Google[/eluser]
[quote author="xwero" date="1203003692"]
- When you extend a controller or a model use include to import the baseclass in the children classes
Code:
// basecontroller.php
class Basecontroller extends Controller
{
....
[/quote]
You won't have to use include if you use a MY_Controller.php in your library folder as Basecontroller. So one hint would be to use:
Code:
// In application/library/MY_Controller.php
class MY_Controller extends Controller {
function MY_Controller()
{
parent::Controller();
}
function yourfunction()
{
echo "Hello world";
}
}
Then yourfunction() will be avaible sitewide in every other controllers that extends the MY_Controller (without having to include them) for example using:
Code:
$this->yourfunction();