Javascript head.phtml 在 Magento 中的位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3877436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Location of head.phtml in Magento
提问by 30Stack
I am working with Magento and need to remove a Javascript that is being included in the <head>
section by default.
我正在使用 Magento,需要删除<head>
默认情况下包含在该部分中的 Javascript 。
I am using a modified theme called modern. I am looking for head.phtml in:
我正在使用一个叫做现代的修改过的主题。我正在寻找 head.phtml:
app/design/frontend/default/modern/template/page/html/head.phtml
It does not exist. I do have header.phtml and footer.phtml. The code from header.phtml starts well after the <body>
of the document.
它不存在。我确实有 header.phtml 和 footer.phtml。header.phtml 中的代码<body>
在文档之后开始。
Where in the world would the head.phtml file be?
head.phtml 文件到底在哪里?
Thanks in advance.
提前致谢。
回答by aforankur
Goto Core theme files in Magento : app/design/frontend/base/default/template/page/html/head.phtml
转到 Magento 中的核心主题文件: app/design/frontend/base/default/template/page/html/head.phtml
copy this file from Base and Paste it to you theme, that is
从 Base 复制此文件并将其粘贴到您的主题中,即
app/design/frontend/default/modern/template/page/html/head.phtml
应用程序/设计/前端/默认/现代/模板/页面/html/head.phtml
Now change here as per your requirement.
现在根据您的要求在此处更改。
To Remove Javascripts goto its XML file i.e. page.xml.
要删除 Javascript,请转到其 XML 文件,即page.xml。
Enjoy :)
享受 :)
回答by 30Stack
I figured out what the problem was. I needed to look in the base directory under the default template:
我想出了问题所在。我需要查看默认模板下的基本目录:
app/design/frontend/base/default/template/page/html
I'm not exactly sure why though.
我不完全确定为什么。
回答by Joseph Mastey
FWIW, JS should usually be removed by commenting/deleting relevant lines from the /layouts files in your theme, not the head template file itself. Unless someone added those script lines manually (naughty code monkey), of course.
FWIW,JS 通常应该通过注释/删除主题中 /layouts 文件中的相关行来删除,而不是头部模板文件本身。当然,除非有人手动添加了这些脚本行(顽皮的代码猴子)。