/** * the variables for the view render * @var array */ public $_params = array(); /** * the assign method * @param string $key * @param mixed $value */ public function assign($key, $value){ $this->_params[$key] = $value; } /** * call template render, with the params array we created in the life cycle * @param string $tpl */ public function render($tpl = 'index'){ parent::render($tpl, $this->_params); }
example of usage in controller:
$this->assign('greetings', 'Yo man!'); $this->assign('model', $model); $this->render('login');