Friday, August 6, 2010

addJs vs addItem in Magento

Using addJs will add a Javascript tag with source file relative to the root directory.

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

If you want to add a Javascript file relative to the skin directory, you need to use addItem instead.

<action method="addItem">
   <type>skin_js</type>
   <name>js/jquery.js</name>
</action>

No comments:

Post a Comment