How to disable layout inside a plugin?

2019-08-12 01:52发布

问题:

Here is what i'm trying to do

<?php
class My_Controller_Plugin_SomePlugin extends Zend_Controller_Plugin_Abstract
{

    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
             $this->_helper->layout()->disableLayout();
    }
}

but it doesn't work, any ideas on how could i disable the layout inside a plugin ?

回答1:

This should be enough if you are using Zend_Layout::startMvc()

Zend_Layout::getMvcInstance()->disableLayout();