特定のアクションではZend_Layoutを使わない

最近は、Zend Framework1.7をちょこちょこ触っております。
その際、Smartyではなく、Zend_Layout&Zend_ViewでView部分を組んでいますが、なかなか良い感じです。

で、表題の、このアクションではLayout使いたくないなーという時、

[php]
public indexAction()
{
Zend_Layout::resetMvcInstance();
}
[/php]

としておけば、そのアクションではLayoutが使われず、Zend_Viewのみ使うことができます。
もちろんZend_Viewも使わずに素で出力したい場合は、

[php]
$this->_helper->viewRenderer->setNoRender();
[/php]

で!

忘れそうなのでメモメモ。

関連する記事:

Powered by

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">