CakePHP: How to Add Theme Support?
Now with CakePHP v1.2 (beta) we can easily add theme with its ThemeView class.
This guide about how to add theme into fresh CakePHP installation will be explained in very basic step-by-step . I learn it frrom here.
Updated: sample code provided
Download code example, extract inside CakePHP root.
First!
Create a file called app_controller.php inside cake\app\controllers.

Edit the file and just with two lines of code, add theme support on your application:
-
class AppController extends Controller {
-
var $view = 'Theme';
-
var $theme = 'default';
-
}
Second!
You need to put all your theme collections inside a folder called themed instead views. This folder doesn't exists yet, so go to cake\app\views and create new folder themed inside it.

Third!
Create another folder called default inside cake\app\views\themed, and place all your template files there.
This theme name is taken from
-
var $theme = 'default';
We can just create another folder and activate it very easily thanks to ThemeView class.
That's it now you have an application that support theme. Easy?! Yea, that was sooo Cake
Tags: php4, cakephp, code example
on March 30th, 2008 at 2:17 am
instead should read inside?
Themes are great I had a play with them a while back, found it perfect for making admin interface entirely separate from the public site. Had some issues when using it in conjunction with assetmapper, but since cake now has settings for asset compression in core.php I am revisiting this
on March 30th, 2008 at 8:22 am
Thanks for your correction