[eluser]echoDreamz[/eluser]
[quote author="InsiteFX" date="1286186780"]This is what a MY_Controller is for! you should really listen to
what users explain to you in the forums.
InsiteFX[/quote]
MY_Controller only works when you have your prefix set to MY_. We have different prefixes for our files vs customer specific files libraries / helpers. So for instance you have the prefix set to Customer_ and you try and use MY_Controller it will not work and will error saying class not found. This is why I use the autoloader above.
But yes, for those who use single prefixed libraries etc, it will work fine.
[quote author="Sumon" date="1286185390"][quote author="echoDreamz" date="1286075352"]
Code:
class MY_SharedController extends Controller
{
function __construct()
{
parent::Controller();
}
function SharedMethod()
{
}
}
class TopController extends MY_SharedController
{
function __construct()
{
parent::__construct();
}
function ControllerMethod()
{
$this->SharedMethod();
}
}
[/quote]
Fatal error: Class 'SharedController' not found in D:\xampplite\htdocs\shopno-dinga-dsebd\application\controllers\sharedController.php on line 3
Please note that, sharedcontroller and topcontrollers are 2 separate files[/quote]
The edited code above will work.