简体   繁体   English

CakePHP TwigView插件缺少视图错误

[英]CakePHP TwigView Plugin Missing View Error

I am using CakePHP 2.4.2 and this plugin by predominant. 我主要使用CakePHP 2.4.2和插件。

I want to use TwigView with CakePHP and found that the plugin above is compatible with CakePHP 2.0. 我想将TwigView与CakePHP一起使用,发现上面的插件与CakePHP 2.0兼容。 Followed all the installation steps, however, getting the Missing View error while executing the script. 遵循所有安装步骤,但是在执行脚本时出现Missing View错误。

My AppController.php 我的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. 视图的范围是.tpl ,但是,即使添加了插件后,它仍在寻找.ctp范围

I have also loaded the plugin in bootstrap.php using 我还使用以下命令在bootstrap.php中加载了插件

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 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. 将应用程序控制器中的Controller :: $ ext属性设置为“ tpl”,即可完成操作。

Searching before asking is also always a good idea, see CakePHP View change extension 在询问之前进行搜索也是一个好主意,请参见CakePHP View更改扩展

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM