Hi, I am making my own PHP-MVC framework. i have a question regarding Controller and View Association. I love the way Zend framework uses view within Controller as follow:
$this->view->data = 'Data here';
so it can be used in view as follow:
echo $this->data;
I am wondering how can i implement this association.
I want to remove codes between /** **/
and want to replace with some magic functions. My codes for controller as as follow:
class UserController extends Controller{
/************************************/
public function __construct(){
$this->view = new View();
$this->view->setLayout( 'home' );
}
function __destruct(){
$this->view->render();
}
/************************************/
public function index(){
$this->redirect('user/login');
}
public function login(){
}
public function register(){
}
public function forgotPassword(){
}
}
Thanks and best regards, -Navi