0

Why can't I add js directly via local.xml but instead have to enter it in the backend cms layout tab? I can reference head in , so for example this will work:

<reference name="head">
    <action method="addLinkRel"><rel>canonical</rel><href>http://www.domain.com/</href><action>
</reference>

While this won't:

<reference name="head">
    <action method="addItem"><type>skin_js</type><name>js/jquery.slides.js"></name><params/></action>
    <action method="addItem"><type>skin_js</type><name>js/jquery.carouFredSel.js"></name><params/></action>
</reference>

Is this behavior intended? Thank you!

  • you are using the cms_index_index layout handle? – Marius Jun 4 '14 at 12:18
0

Issue was <name>js/jquery.slides.js"></name> should be <name>js/jquery.slides.js"</name> Here the complete code is

<?xml version="1.0"?>
<layout version="0.1.0">
  <cms_index_index>
    <reference name="head">
         <action method="addItem"><type>skin_js</type><name>js/jquery.slides.js</name><params/></action>
         <action method="addItem"><type>skin_js</type><name>js/jquery.carouFredSel.js</name><params/></action>
    </reference>
  </cms_index_index>
</layout>
2

There is bug in your code. Try this code

<reference name="head">
        <action method="addItem"><type>skin_js</type><name>js/jquery.slides.js</name><params/></action>
        <action method="addItem"><type>skin_js</type><name>js/jquery.carouFredSel.js</name><params/></action>
</reference>
  • How did I not see this... Thank you so much! I chose Amits answer as the top one, as he elaborates on the issue somewhat more ;) – loeffel Jun 5 '14 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.