本文介绍了CakePHP TwigView插件缺少查看错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我主要使用CakePHP 2.4.2和插件。

I am using CakePHP 2.4.2 and this plugin by predominant.

我想使用TwigView和CakePHP,发现上面的插件与CakePHP 2.0兼容。然后执行所有安装步骤,在执行脚本时出现缺少视图错误。

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.

我的AppController.php

My AppController.php

<?php

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

class AppController extends Controller {

    public $viewClass = 'TwigView.Twig';

}

视图的扩展名为 .tpl ,但是,即使在添加插件后,它仍然在寻找 .ctp 扩展。

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

我也在bootstrap.php中加载了插件使用

I have also loaded the plugin in bootstrap.php using

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

任何想法可能会出错。

推荐答案

在应用程式控制器中设定Controller :: $ ext属性totpland your're done。

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插件缺少查看错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 14:43