31 lines
890 B
PHP
31 lines
890 B
PHP
<?php
|
|
class Application_Controller_Plugin_Themes extends Zend_Controller_Plugin_Abstract
|
|
{
|
|
public function routeShutdown($request)
|
|
{
|
|
$theme = 'default';
|
|
|
|
if ($theme !== 'default') {
|
|
|
|
$module = $request->getModuleName();
|
|
|
|
if ($module === 'default') {
|
|
$layoutPath = APPLICATION_PATH . '/views/' . $theme;
|
|
$viewPath = APPLICATION_PATH . '/views/' . $theme;
|
|
} else {
|
|
$layoutPath = APPLICATION_PATH . '/modules/' . $module . '/views/' . $theme;
|
|
$viewPath = APPLICATION_PATH . '/modules/' . $module . '/views/' . $theme;
|
|
}
|
|
|
|
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
|
|
|
|
$view = $bootstrap->bootstrap('View')->getResource('View');
|
|
$view->setBasePath($viewPath);
|
|
|
|
$layout = $bootstrap->bootstrap('Layout')->getResource('Layout');
|
|
$layout->setLayout('main');
|
|
$layout->setLayoutPath($layoutPath);
|
|
|
|
}
|
|
}
|
|
} |