Ok, I'm running on my own MVC OOP Framework, and I have a base controller class that all of the other controllers extend so they all can share variables that are within the parent class that are collected from a registry I have setup in the index file.
Anyway, I have the parent class, Model_Conduct_Controller setup so that it uses it's constructor to declare variables for its childres like so:
class Model_Conduct_Controller extends sFrame
{
public function __construct()
{
// Base Registry Class Instance
$registry = sRegistry::getInstance();
// Variable Declaration
$this->database = $registry->getVar('database');
$this->config = $registry->getVar('config');
}
}
Then I create a controller extending it:
class IndexController extends Model_Internal_Controller
{
public function indexAction()
{
}
}
Simple right? Not for me...my issue is echo'ing out those variables that are stored within the controller of the parent; the variables that are automatically transcribed to the controllers upon extension of the parent.
I tried to use var_dump to check one of the variables, and I got:
Fatal error: Using $this when not in object context in C:\Users\Server\application\controllers\IndexController.php on line 12
In my dispatcher class, I use call_user_func() to instantiate the controller classes. I have a feeling that for some reason, that may be the issue, but I'm not sure.