Skip to content

Commit

Permalink
adding the theme to the routes array so it can be checked, and updati…
Browse files Browse the repository at this point in the history
…ng the theme loader to make use of routes to decide the theme.
  • Loading branch information
dogmatic69 committed Jan 14, 2010
1 parent 0c45aa1 commit 4d99b41
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions extensions/libs/controllers/components/infinitas.php
Expand Up @@ -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'];
}
}
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions infinitas/management/models/route.php
Expand Up @@ -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']
);
}

Expand Down

0 comments on commit 4d99b41

Please sign in to comment.