How to get current theme name or theme working in cakephp

Making theme set and available by setting theme related properties in controller

Prior to cakephp 2.0

class UserController extends AppController {
    var $view = 'Theme'; //tells controller to use "ThemeView" class instead of the default "View" class
    var $theme = 'WhiteFeather'; //name of the theme folder which is supposed to be placed at views/themed/
}

Cakephp 2.0

class UserController extends AppController {
    public $viewClass = 'Theme'; //tells controller to use "ThemeView" class instead of the default "View" class
    public $theme = 'WhiteFeather'; //name of the theme folder which is supposed to be placed at View/Themed
}

Theme can be changed within a controller function or in beforeFilter/beforeRender by overriding the theme property:

$this->theme = 'BlackFeather';

You may want to know more about themes, here:
CakePHP 1.3 link http://book.cakephp.org/view/1093/Themes
Cakephp 2.0 documentation http://book.cakephp.org/2.0/en/views/themes.html

2 thoughts on “How to get current theme name or theme working in cakephp

Leave a Reply