Cristiano Santos
Cristiano Santos

Reputation: 2137

Zend Layout for specific Actions

Is there a simple way of just enable a layout for the actions of a controller, instead of disabling it in all other actions of other controllers in Zend?

Upvotes: 1

Views: 325

Answers (1)

Alex Pliutau
Alex Pliutau

Reputation: 21947

class IndexController extends Zend_Controller_Action
{
    public function init()
    {
        // For all actions
        Zend_Layout::getMvcInstance()->disableLayout();
    }

    public function myAction()
    {
        // For specific action
        Zend_Layout::getMvcInstance()->setLayout('my');
    }
    // ...
}

Upvotes: 3

Related Questions