【问题标题】:CakePHP TwigView Plugin Missing View ErrorCakePHP TwigView 插件缺少视图错误
【发布时间】:2013-11-22 05:59:51
【问题描述】:

我主要使用 CakePHP 2.4.2 和 this 插件。

我想在 CakePHP 中使用 TwigView,发现上面的插件与 CakePHP 2.0 兼容。但是,按照所有安装步骤操作,在执行脚本时出现 Missing View 错误。

我的 AppController.php

<?php

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

class AppController extends Controller {

    public $viewClass = 'TwigView.Twig';

}

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

我还使用

在 bootstrap.php 中加载了插件
CakePlugin::load('TwigView');
define('TWIG_VIEW_CACHE', APP . 'tmp');

任何想法可能会出错。

【问题讨论】:

  • 有一个公开的拉取请求听起来可以解决您的问题:github.com/predominant/TwigView/pull/19
  • 不需要修复,看我的回答。
  • @burzum 我认为问题在于视图中的 $ext 属性被控制器中定义的属性覆盖,并且在编写插件时它的工作方式有所不同。

标签: php cakephp cakephp-2.0 twig cakephp-2.4


【解决方案1】:

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

将应用控制器中的 Controller::$ext 属性设置为“tpl”,就完成了。

在询问之前搜索也是一个好主意,请参阅CakePHP View change extension

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-21
    • 1970-01-01
    相关资源
    最近更新 更多