如何有两个控制器动作,一个 Zend_Controller_Action 类的共享视图?
Posted
技术标签:
【中文标题】如何有两个控制器动作,一个 Zend_Controller_Action 类的共享视图?【英文标题】:how to have two controller actions, one shared view for Zend_Controller_Action Class? 【发布时间】:2009-09-11 17:18:17 【问题描述】:如何为给定的控制器操作方法指定自定义视图脚本?
例如:
Class UserGalleryController extends Zend_Controller_Action
public function fooAction()
$this->view->actionMsg = 'foo';
// (uses foo.phtml automagically)
public function barAction()
$this->view->actionMsg = 'bar';
//use foo's view script ?????
I basically want to have one view script (foo.phtml)
谢谢:-)
【问题讨论】:
【参考方案1】:public function barAction()
$this->view->actionMsg = 'bar';
$this->render('foo');
【讨论】:
以上是关于如何有两个控制器动作,一个 Zend_Controller_Action 类的共享视图?的主要内容,如果未能解决你的问题,请参考以下文章