Disabling View And Layout

If you are using MVC components of Zend Framework, you will come across situations where you will have to disable view and layout. To do so you use the viewRenderer and layout action helpers and call the setNoRenderer() and disableLayout() methods respectively.

How to disable the view?

In your controller action

<?php
$this
->_helper->viewRenderer->setNoRender(true);
?>

How to disable the layout?

In your controller action

<?php
$this
->_helper->layout->disableLayout()
?>

Did the code snippet solve your problem?

About the author

Sudheer is an entrepreneur and software developer. Get more from Sudheer on Twitter.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.