Created
July 1, 2011 04:53
-
-
Save jimbojsb/1057888 to your computer and use it in GitHub Desktop.
Module-specific layouts in Zend Framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Genoa_Controller_Plugin_SwitchLayout extends Zend_Controller_Plugin_Abstract | |
{ | |
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) | |
{ | |
$module = $request->getModuleName(); | |
$layoutName = $module; | |
$layoutPath = APPLICATION_PATH . "/modules/$module/views/layouts"; | |
Zend_Layout::startMvc(); | |
$layout = Zend_Layout::getMvcInstance(); | |
$layout->setLayout($layoutName); | |
$layout->setLayoutPath($layoutPath); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah definitely. In this case, I didn't want them to share a layout. I could do one big layout folder though in case they needed to share one but also have separate ones