【问题标题】:CakePHP 2.5 Theme and layout not loadingCakePHP 2.5 主题和布局未加载
【发布时间】:2014-06-17 20:17:59
【问题描述】:

我正在尝试将主题与 CakePHP 2.5.X 一起使用,但未能在该主题内加载主题和相关布局。我所做的是创建“app/View/Themed/Hamilton”,并在我创建的那个目录中创建“View/Layouts/default.ctp”。在“app/Controller/AppController.php”中我已经这样做了:

public $viewClass = 'Theme'; /* I've tried $view, it does not work. */
public $theme = 'Hamilton';
public $layout = 'default';

遗憾的是,它加载的是“app/View/Layouts/default.ctp”,而不是“app/View/Themed/Hamilton/View/Layouts/default.ctp”

我已经搜索堆栈溢出,没有任何文章讨论这个问题有一个有效的答案。所有调试输出正确的布局、主题等。我检查了拼写和大小写。它只是没有加载。有人有新的看法吗?

更新:一旦我提出问题,我就会找到解决方案。布局路径错误。它应该是“App/View/Themed/Hamilton/Layouts/default.ctp”,不需要另一个“View”文件夹。

希望这可以帮助遇到同样问题的其他人。

【问题讨论】:

    标签: cakephp themes cakephp-2.5


    【解决方案1】:

    根据the docs,布局应该在/app/View/Themed/Example/Layouts/,所以在你的情况下它是/app/View/Themed/Hamilton/Layouts/default.ctp,而不是你说的app/View/Themed/Hamilton/View/Layouts/default.ctp

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-11
      • 2021-12-12
      • 1970-01-01
      相关资源
      最近更新 更多