I usually call $this->_helper->viewRenderer('view-script') to set
which view script I want to render.
$this->render('view-script') would have to be called at the end as you
said. If you are looking to get the contents of a rendered view script
in a variable, you can use $viewScript = $this->view-
>render('scriptdir/view-script.phtml');
Adam
On Jul 31, 2008, at 5:10 AM, Ralf Eggert wrote:
> Hi,
>
> just a quick question to make sure. Within a controller action called
> showAction I would like to change the script depending on the current
> design. So I would like to change it from 'show.phtml' to
> 'show1.phtml',
> 'show2.phtml' or 'show3.phtml'. What is the proper way to change the
> view script within a controller action?
>
> In the manual I found this section, which uses render():
> http://framework.zend.com/manual/en/zend.controller.action.html#zend.controller.action.viewintegration.render
>
> I guess that this render() method should be called at the end of the
> showAction method of the controller to make sure that all stuff is
> done
> within showAction.
>
> Or is there another way just to change the view script name without
> calling the render() method and let the View Renderer do the job?
>
> Best regards,
>
> Ralf
>
没有评论:
发表评论