Before I start just letting you know that I'm new to OOP programming so take it easy on me.
I'm currently working on a PHP framework and I've been able to route my traffic through one entry point. This is the structure below..
index ----> bootstrap ----> router ----> controller
Here's the main controller...
class controller {
protected $_model;
protected $_controller;
protected $_id;
protected $_view;
function __construct($controller,$model,$view,$id=NULL) {
$this->_controller = $controller;
$this->_id = $id;
$this->_model = $model;
$this->_view = $view;
$this->$model = new $model;
$this->_view = new view;
}
function filter($data) {
$data = trim(htmlentities(strip_tags($data)));
if (get_magic_quotes_gpc())
$data = stripslashes($data);
$data = mysql_real_escape_string($data);
return $data;
}
function set($name,$value) {
$this->_view->set($name,$value);
}
function __destruct(){
$this->_view->render();
}
}
In my construct function it's suppose to set the...
$this->$model = new $model; and $this->_view = new view;
But when I run either $this->_view->render(); or $gamerequests_array = $this->main_model->tab_query($tab);
It says the object doesn't exist. Here's the exact error message I get.
Notice: Undefined property: main_controller::$main_model and
Fatal error: Call to a member function tab_query() on a non-object
So at this point I know that the problem is the framework setting up the new objects. I've been trying to figure this out and at this point I need some help.
If anyone needs extra code feel free to request it, I'll post it.
$this->_viewand$this->$modelcan't work too, because it's an object.