CakePHP主题资源返回错误

发布于 2024-10-16 08:44:36 字数 765 浏览 2 评论 0原文

我过去从未遇到过 CakePHP 主题系统的问题,但现在错误很多。我的主要问题是所有主题资源(/app/views/themed/MyTheme/webroot/* 中的资源)无法加载。我在 /app 中设置了一个自定义 AppController 来设置主题。

var $view = "Theme";
var $theme = "MyTheme";

当我转到任何页面时,我都可以看到它正在利用我的主题的 default.ctp 布局,并且 HTML 很好。任何和所有页面资源、CSS、JavaScript、图像、主题 webroot 中的任何内容都无法加载,并给出如下错误(假设我尝试访问 http://example.com/theme/MyTheme/img/bg.png):

Error: ThemeController could not be found.

Error: Create the class ThemeController below in file: app/controllers/theme_controller.php

<?php
class ThemeController extends AppController {

    var $name = 'Theme';
}

我从未在我的应用程序中收到过这样的错误使用 CakePHP 的时间。我正在运行最新的稳定版本 1.3.7。

I've never had problems with CakePHP's theming system in the past, but now, errors galore. My main issue is that all theme resources (those in /app/views/themed/MyTheme/webroot/*) fail to load. I've set up a custom AppController in /app to set the theme.

var $view = "Theme";
var $theme = "MyTheme";

When I go to any page, I can see that it's utilizing my theme's default.ctp layout and the HTML is fine. Any and all page resources, CSS, JavaScript, images, anything in the theme webroot, fails to load and instead gives me an error like the following (let's say I tried to access http://example.com/theme/MyTheme/img/bg.png):

Error: ThemeController could not be found.

Error: Create the class ThemeController below in file: app/controllers/theme_controller.php

<?php
class ThemeController extends AppController {

    var $name = 'Theme';
}

I've never received an error like this in my time with CakePHP. I'm running the latest stable version at 1.3.7.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终止放荡 2024-10-23 08:44:36

我终于找到了解决方案。 CakePHP 不喜欢我的大写主题名称。事实上,我尝试的任何包含大写字符的主题名称都无法正常工作。我将文件夹名称和内部主题名称从“MyTheme”更改为“my_theme”,效果非常好。可能是一个错误,但它可能是未记录的但预期的功能。

I've finally found a solution. CakePHP didn't like my uppercase theme name. In fact, any theme name that I tried that included uppercase characters failed to work. I changed my folder name and internal theme name from "MyTheme" to "my_theme" and it worked perfectly. Could possibly be a bug, but it could be undocumented, yet expected functionality.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文