CakePHP 2.x theme not working

旧街凉风 提交于 2019-12-12 03:44:05

问题


I have a problem with CakePHP (newest version) themes. I have created new theme to /app/View/Themed/Start/

and it contains default.ctp inside the Start folder.

I have edited /app/Controller/AppController.php and I placed this code inside it:

    class ThemeController extends AppController {
    public $theme = 'Start';
}

But it still uses the default layout instead of my own template. What am I doing wrong here?


回答1:


That code shouldn't be placed in AppController (Or anywhere for that matter) all you simply need to do is set the theme in AppController like this:

class AppController extends Controller {
    public $theme = 'Start';

It will then take your view files from app/View/Themed/Start



来源:https://stackoverflow.com/questions/15189231/cakephp-2-x-theme-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!