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

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

问题描述

我正在修改 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:

skin_jsjs/custom-script.js

进入/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.

推荐答案

尝试将以下内容添加到您的布局 .xml 文件中

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

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

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

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