CakePHP TwigView Plugin Missing View Error

2019-02-21 02:45发布

I am using CakePHP 2.4.2 and this plugin by predominant.

I want to use TwigView with CakePHP and found that the plugin above is compatible with CakePHP 2.0. Followed all the installation steps, however, getting the Missing View error while executing the script.

My AppController.php

<?php

App::uses('Controller', 'Controller');

class AppController extends Controller {

    public $viewClass = 'TwigView.Twig';

}

The view's extention is .tpl, however, even after adding the Plugin it is still looking for .ctp extention.

I have also loaded the plugin in bootstrap.php using

CakePlugin::load('TwigView');
define('TWIG_VIEW_CACHE', APP . 'tmp');

Any Idea what could go wrong.

1条回答
别忘想泡老子
2楼-- · 2019-02-21 03:06

http://api.cakephp.org/2.4/source-class-Controller.html#209-214

Set the Controller::$ext property in your app controller to "tpl" and your're done.

Searching before asking is also always a good idea, see CakePHP View change extension

查看更多
登录 后发表回答