如何在Magento主题中添加/包含js文件 [英] How to add/include js file into Magento theme

查看:337
本文介绍了如何在Magento主题中添加/包含js文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修改Magento主题。并希望将js文件添加到主题 / js 文件夹中。我添加了以下代码:

I am modifying a Magento theme. And want to add a js file into the theme /js folder. I have added the following code:

< action method =addItem>< type> skin_js< / type>< name> ; js / custom-script.js< / name>< / action>

进入 / app / design / frontend / theme-name / default / layout / page.xml 并将js文件发布到 / skin / frontend / theme-name / default / js / 。但没有运气。它没有显示在页面上。有人请帮我纠正这个。谢谢。

into the /app/design/frontend/theme-name/default/layout/page.xml and published the js file into /skin/frontend/theme-name/default/js/. But no luck. It is not showing on the page. Someone please help me to rectify this. Thanks.

推荐答案

尝试将以下内容添加到您的布局 .xml 文件中在< reference name =head>

Try adding the following to your layout .xml file within <reference name="head">

<action method="addJs">
    <script>js/custom-script.js</script>
</action>

这篇关于如何在Magento主题中添加/包含js文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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