問題描述
我使用的是 CakePHP 2.4.2 和 this 插件.
我想在CakePHP 中使用TwigView,發(fā)現(xiàn)上面的插件與CakePHP 2.0 兼容.執(zhí)行了所有安裝步驟,但是在執(zhí)行腳本時出現(xiàn) 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
將應(yīng)用控制器中的 Controller::$ext 屬性設(shè)置為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
這篇關(guān)于CakePHP TwigView 插件缺少視圖錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!