CakePHP主题资源返回错误 [英] CakePHP theme resources return error

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

问题描述

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

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";

当我去任何页面,我可以看到它正在利用我的主题的default.ctp布局和HTML是好的。任何和所有的页面资源,CSS,JavaScript,图像,任何东西在主题webroot,无法加载,而是给我一个错误,如下所示(让我们说,我试图访问 http://example.com/theme/MyTheme/img/bg.png ):

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';
}



我在CakePHP的时候从未收到过这样的错误。我在1.3.7运行最新的稳定版本。

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

推荐答案

我终于找到了一个解决方案。 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.

这篇关于CakePHP主题资源返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆