如何将 js 文件添加/包含到 Magento 主题中

编程入门 行业动态 更新时间:2024-10-10 16:21:08
本文介绍了如何将 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 主题中

本文发布于:2023-11-28 19:56:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643756.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   文件   主题   js   Magento

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!