如何有两个控制器动作,一个Zend_Controller_Action类的共享视图?

时间:2009-09-11 17:18:17

标签: zend-framework view controller

如何为给定的Controller Action方法指定自定义视图脚本?

例如:

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 个答案:

答案 0 :(得分:0)

public function barAction()
{
    $this->view->actionMsg = 'bar';
    $this->render('foo');
}