I'm not sure if this is right or wrong, but basically, I create a layout instance in my bootstrap and set it to disabled..

Then, each modules has it's own abstract controller, and I use the init() method of there to specify the layout for the module. Is this not something I should be doing, and should instead be leaving to a plugin like you did below? I used to use that method but found the init() method above better (can't remember why though)...

Best Regards,
Eric

On Apr 23, 2008, at 2:42 PM, Robin Skoglund wrote:
I'd consider writing a postDispatch plugin, so you know what module you're
actually dispatching. Something like:

class My_Controller_Plugin_ModuleLayout extends
Zend_Controller_Plugin_Abstract
{
public function postDispatch(Zend_Controller_Request_Abstract $request)
   {
       $layout = Zend_Layout::getMvcInstance();
       $module = $request->getModuleName();
       $layout->setLayout($module);
   }
}

Then in your bootstrap you do $front->registerPlugin(new
My_Controller_Plugin_ModuleLayout()).

Of course, you could also do something more specific, e.g. limiting to only a few layouts and use a switch-case. Endless possibilites. This should also
be a quite portable way of doing things.

Robin

On Wed, Apr 23, 2008 at 8:09 PM, rollockg <
[EMAIL PROTECTED]> wrote:


Is there a way to define in my bootstrap a separate layout path for each
module?
--
View this message in context:
http://www.nabble.com/Alternate-layouts-by-module-tp16834740p16834740.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Reply via email to