I'm building a framework. I have a problem loading in multiple controllers, because they extend a base controller, where the instances are changed to the last loaded controllers options. How can i affect only the extended base controller of the controller class, that I'm currently working in, instead of affecting all instances of the base controller?
class loader
{
private static $_inst;
public function __construct($class)
{
self::$_inst = $class;
}
}
abstract class base_controller
{
protected $load;
public function __construct()
{
$this->load = new loader($this);
}
}
class controller1 extends base_controller {}
class controller2 extends base_controller {}
When the first controller loads, it sets the instance in the loader. But when you load the second controller, it sets controller1's loader objects static $_inst to controller2's instance. Suggestions?