magento 添加css 和 js 的方法
一, 添加到xml文件中
1 2 3 4 5 6 7 8 | <reference name="head">
<action method="addCss"><stylesheet>css/thisme.css</stylesheet></action>
<!--添加 css thisme.css 文件在 /skin/frontend/主题包文件夹/主题文件夹/css-->
<action method="addItem"><type>skin_js</type><name>js/thisme.js</name></action>
<!--添加 js thisme.js 文件在 /skin/frontend/主题包文件夹/主题文件夹/js-->
<action method="removeItem"><type>js</type><name>prototype/thisme.js</name></action>
<!--删除js 此thisme.js文件在magento根目录的 js文件夹-->
</reference> |
第二种就是直接在phtml文件调用, 如下:
1 2 | <script type="text/javascript" src="<?php echo $this->helper('core/js')->getJsSkinUrl('')?>highslide/highslide-with-gallery.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->helper('core/js')->getJsSkinUrl('')?>highslide/highslide.css" /> |
