1

I am attempting to load a javascript file in my custom skin using the following code in local.xml.

<?xml version="1.0"?>
<layout>
   <default>
        <!-- remove some things that NKI doesn't use -->
        <reference name="head">
                <action method="addItem"><type>skin_js</type><script>js/nki.js</script></action>

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

Why does it first attempt to look in the base theme skin directory, then my directory?

I see it's attempting to load

The file exists in /var/www/skin/frontend/NKI/NKI/js/nki.js

I am a little confused. Maybe my method for loading using local.xml is outdated. Any suggestions? Maybe I have a setting wrong in admin?

EDIT: added local.xml location

app/design/frontend/NKI/default/layout/local.xml

  • can you please update your question with local.xml file path? – Abhishek Panchal Sep 8 '17 at 18:07
  • I've added the location of layout.xml. – CarComp Sep 8 '17 at 18:11
  • 1
    its local.xml not layout.xml. I Edited your question – Abhishek Panchal Sep 8 '17 at 18:21
2

your local.xml file is in wrong path. It should be inside

app/design/frontend/{package}/{theme}/layout/local.xml

In your case

app/design/frontend/NKI/NKI/layout/local.xml

In local.xml

<?xml version="1.0"?>
<layout>
   <default>
        <!-- remove some things that NKI doesn't use -->
        <reference name="head">
                <action method="addItem"><type>skin_js</type><name>js/nki.js</name></action>
        </reference>
   </default>
</layout>

It should be <name> instead of <script> tag

Hope it helps :)

  • Those were some spot-on suggestions. I made those changes, and things magically started working. – CarComp Sep 8 '17 at 18:34
  • Glad to know that its working fine – Abhishek Panchal Sep 8 '17 at 18:36

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.