我使用的是 CakePHP 2.4.2 和 this 插件.
我想在CakePHP 中使用TwigView,发现上面的插件与CakePHP 2.0 兼容.执行了所有安装步骤,但是在执行脚本时出现 Missing View 错误.
我的 AppController.php
视图的扩展名是 .tpl,但是,即使添加了插件,它仍然在寻找 .ctp 扩展名.
我还在 bootstrap.php 中使用
加载了插件CakePlugin::load('TwigView');定义('TWIG_VIEW_CACHE',APP.'tmp');
不知道会出什么问题.
http://api.cakephp.org/2.4/source-class-Controller.html#209-214
将应用控制器中的 Controller::$ext 属性设置为tpl"即可.
询问前先搜索也总是一个好主意,请参阅CakePHP 查看更改扩展>
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.
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
这篇关于CakePHP TwigView 插件缺少视图错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!