[eluser]jwright[/eluser]
[quote author="Jelmer" date="1279839987"]Maybe just like this? (not pretty but probably works)
Code:
<?php
require APPPATH . 'controllers/done.php';
class Todo extends Done
{
public function __construct()
{
parent::__construct();
echo "Todo constructor<br/>";
}
public function index()
{
echo "Inside Todo index <br/>";
}
}
I haven't done this, but I have worked with multiple base controllers. I implemented those by writing an autoloader that would autoload the class after "extends". Thus avoiding needing "require" and it might also be a better solution for you. Write one abstract base controller and then extend both Todo and Done from that base.[/quote]
I like this for a couple reasons.
1. It explicitly shows the file where the base class is located
2. It should work on any CI install even if an autoloader is not setup
That's not to say autoloaders don't have their place. It's nice to not have to worry about these require statements, especially if you would need a lot of them.