0

我使用添加了js

addJs

在下面的代码中,它是我的布局文件,所以我想把 jquery.js 文件放在哪里,请提供我的路径

<reference name="head">
 <action method="addJs"><script>my_extension/jquery.js</script></action>
</reference>

我指的是这个

http://www.activo.com/how-to-load-jquery-and-prototype-in​​-magento-admin-panel

但是在哪里放置我的js文件?

我不明白这个

4

2 回答 2

2

如果您正在谈论您所写的 adminhtml,那么只需将其放入js/my_extension/

于 2012-12-31T11:27:30.303 回答
1

Create local.xml file in your themes layout directory and place your code like this and place your js file here "/skin/frontend/INTERFACE/THEME/js/". If you use addjs methods you have to place your js file under "your magento root/js/" folder. Here is an example.

<?xml version="1.0"?>
<layout version="0.1.0">
<default>
    <reference name="head">
        <!-- Magento looks in /skin/frontend/<INTERFACE>/<THEME>/js/buyprinting.js
        for this file -->
        <action method="addItem"><type>skin_js</type><name>js/buyprinting.js</name></action>
        <!-- This removes the item that was set in the page.xml file -->
        <action method="removeItem"><type>skin_js</type><name>js/iehover-fix.js</name></action>

        <!-- Magento looks in /js/prototype/element.storage.js for this file -->
        <action method="addJs"><name>prototype/element.storage.js</name></action>

    </reference>
</default>
</layout>

Note: If you still unsure where to place your js file go to your browser and click on view source. Here check your js file and place the js file accordingly.

于 2012-12-31T09:33:25.930 回答