CakePHP 2.x theme not working

2019-08-21 17: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条回答
太酷不给撩
2楼-- · 2019-08-21 17:48

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

查看更多
登录 后发表回答