为什么 Magento 1.4 通过文件系统路径包含 javascript 文件?
我正在使用 Magento 1.4 测试 Magento 1.3 站点。我看到非常奇怪和不一致的行为。 Magento 没有包含我的 javascript 文件的 URL,而是使用 js 文件的完整文件系统路径创建标签,如下所示:
<script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototype.js"></script>
我相信这与新的“主题 JavaScript 和 CSS 文件合并为一个文件”功能有关。事实上,当我登录管理员并单击“刷新 JavaScript/CSS 缓存”时,第一个页面加载成功,我看到一个 JS 包含类似于:
<script type="text/javascript" src="/media/js/5b8cfac152fcb2a5f93ef9571d338c54.js"></script>
但后续的年龄加载会加载每个 JS 文件,并包含完整的 JS 文件。路径名称。这显然是行不通的。有人对可能出现的问题或如何解决此问题有任何想法吗?
I am in the process of testing a Magento 1.3 site using Magento 1.4. I am seeing very weird and inconsistent behavior. Instead of including the URL of my javascript files, Magento is creating tags with the full filesystem path of the js files, as so:
<script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototype.js"></script>
I believe this is related to the new "Themes JavaScript and CSS files combined to one file" function. In fact, when I log into the admin and click "Flush JavaScript/CSS Cache", then the first page load is successful, and I see a single JS include similar to:
<script type="text/javascript" src="/media/js/5b8cfac152fcb2a5f93ef9571d338c54.js"></script>
But subsequent age loads load every single JS file, with the full path names. Which obviously isn't going to work. Anyone have any ideas on what could be wrong or how to fix this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
就我而言,这是权限问题。这些 ssh 命令在 Magento 的根目录中运行修复了它:
如果仍然不起作用,则将 MySQL 中 core_config_data 中路径列的这两个值从“1”更改为“0”:
It was permissions issue in my case. These ssh commands run in the root directory of Magento fixed it:
If it still doesn't work then change these two values for path column in the core_config_data in MySQL from "1" to "0":
进入系统->配置->开发者设置-> JavaScript 设置 ->合并 JavaScript 文件(测试版)并将其设置为“否”。这确实是一个测试版:D
go to System -> Configuration -> Developer Settings -> Javascript Settings -> Merge JavaScript Files (beta) and set it to "no". It is realy a beta :D
编辑 config.xml 对我来说没有效果,我必须在数据库中禁用它。
在表“core_config_data”中,将路径为“dev/js/merge_files”(config_id 772) 的行的值设置为“0”。
不过还是谢谢你给我指明了正确的方向!
Editing the config.xml didn't do the trick for me, I had to disable it in the database.
In table 'core_config_data' set the value of the row with path 'dev/js/merge_files' (config_id 772) to '0'.
Thanks for pointing me in the right direction though!
我遇到了同样的问题,并提出了以下解决方案:
两者的结合实际上让事情恢复了正常。
I had the same problem and came up with the following solution:
The combination of the two actually got things back to normal.
检查您的媒体文件夹是否可供您运行网络服务器的用户写入。
我有一个指向只能由 root
帮助写入的文件夹的符号链接。
Check if your media folder is writeable by the user you webserver runs with.
I had a symlink to a folder that was only writeable by root
helped.
我有同样的问题。
这是因为 magento 找不到 javascript 文件。查看您的 /var/log/exception.log (您必须在系统 -> 配置 -> 开发人员选项中启用日志)
在我的日志中出现以下错误:
异常“异常”,并带有消息“警告:filemtime()” [function.filemtime]:第 631 行 /var/www/app/code/core/Mage/Core/Helper/Data.php 中 /var/www/js/calendar/lang/calendar-en.js 的统计失败在 /var/www/app/code/core/Mage/Core/functions.php:245
所以我创建了该文件,瞧它可以工作了!
I had the same Problem.
Its because magento can't find a javascript file. Look at your /var/log/exception.log (You have to enable the log in System -> Config -> Developer Options)
In my log was the following error:
exception 'Exception' with message 'Warning: filemtime() [function.filemtime]: stat failed for /var/www/js/calendar/lang/calendar-en.js in /var/www/app/code/core/Mage/Core/Helper/Data.php on line 631' in /var/www/app/code/core/Mage/Core/functions.php:245
So I created the file and voila it works !
编辑 config.xml 对我来说没有效果,我必须在数据库中禁用它。
在表
core_config_data
中,将路径dev/js/merge_files (config_id 772) 的行的值设置为“0”
。不过还是谢谢你给我指明了正确的方向!
这个解决方案对我有用,谢谢。
Editing the config.xml didn't do the trick for me, I had to disable it in the database.
In table
core_config_data
set the value of the row with pathdev/js/merge_files (config_id 772) to '0'
.Thanks for pointing me in the right direction though!
This solution is worked for me, thanks.
配置中“Web”下的各个基本 URL 字段的值是什么? 类似。
应该与基本皮肤 URL
What are the values for the various Base URL fields under "Web" in the configuration? Should be something along the lines of
for the base skin URL.
该问题与 javascript 合并选项有关。不幸的是,如果没有 JavaScript,该表单将无法工作。您必须将 app/code/core/Mage/Core/etc/config.xml 中的 merge_files 选项更改为 0。
之后,我删除了 var 目录中的所有缓存文件和会话文件。
The problem is related with the javascript merge option. Unfortunatly the form does not work without javascript. You have to change the merge_files option in app/code/core/Mage/Core/etc/config.xml to 0.
After that I removed all cache files and session files in var directory.
在magento 1.4中,config_id是879(对我来说)
将此值设置为 0 可以恢复所有 .js 文件。超级奇怪
in magento 1.4 the config_id is 879 (for me)
Setting this value to 0 gave me all my .js files back. Super weird