View Single Post
  #2 (permalink)  
Old 10-04-2008, 05:40 PM
Cypher Cypher is offline
Junior Member
 
Join Date: Oct 2008
Posts: 4
Default

Gosh, sometimes one has to ask a question to find an answer himself...
Two minutes after I posted the topic, I found an explanation here: Per Module Zend_Layout | Views From The Hill

You can do it by calling
[PHP]$layout = Zend_Layout::getMvcInstance();[/PHP]
in your plugins preDispatch() function and then you can do something like this:
[PHP]
<?php

class Custom_Plugin_Dispatcher extends Zend_Controller_Plugin_Abstract
{

public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();

$layout = Zend_Layout::getMvcInstance();

switch ($controller) {
case 'index':
// use default layout specified in your bootstrap
break;

case 'ajax':
$layout->setLayout('ajax');
break;

case 'error:
$layout->setLayout('error');
break;

default:
$layout->disableLayout();
break;
}
}

public function postDispatch(Zend_Controller_Request_Abstract $request)
{
}

}

?>
[/PHP]
Reply With Quote