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!

1
  • you are using the cms_index_index layout handle? Commented Jun 4, 2014 at 12:18

2 Answers 2

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>
0
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>
1
  • 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 ;) Commented Jun 5, 2014 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.