diff --git a/extensions/libs/controllers/components/infinitas.php b/extensions/libs/controllers/components/infinitas.php index 224bcdea9..327930697 100644 --- a/extensions/libs/controllers/components/infinitas.php +++ b/extensions/libs/controllers/components/infinitas.php @@ -65,6 +65,21 @@ function setupTheme(){ $this->Controller->theme = $theme['Theme']['name']; } Configure::write('Theme',$theme['Theme']); + + $routes = Cache::read('routes', 'core'); + + if (!$routes) { + $routes = Classregistry::init('Management.Route')->getRoutes(); + } + + $currentRoute = Router::currentRoute(); + if (!empty($routes)) { + foreach( $routes as $route ){ + if ( $route['Route']['url'] == $currentRoute->template && !empty($route['Route']['theme'])) { + $this->Controller->theme = $route['Route']['theme']; + } + } + } } /** diff --git a/infinitas/management/models/route.php b/infinitas/management/models/route.php index 3dcea4ead..5efa7612b 100644 --- a/infinitas/management/models/route.php +++ b/infinitas/management/models/route.php @@ -93,11 +93,11 @@ function getRoutes(){ foreach( $routes as $array ){ $vaules = $regex = array(); - $routingRules[]['Route'] = array( 'url' => $array['Route']['url'], 'values' => $this->_getValues($array['Route']), - 'regex' => $this->_getRegex($array['Route']['rules'], $array['Route']['pass']) + 'regex' => $this->_getRegex($array['Route']['rules'], $array['Route']['pass']), + 'theme' => $array['Theme']['name'] ); }