I am modifying a Magento theme. And want to add a js file into the theme /js
folder. I have added the following code:
<action method="addItem"><type>skin_js</type><name>js/custom-script.js</name></action>
into the /app/design/frontend/theme-name/default/layout/page.xml
and published the js file into /skin/frontend/theme-name/default/js/
. But no luck. It is not showing on the page. Someone please help me to rectify this. Thanks.
You can add your custom JS file in your theme's
local.xml
, located in: /app/design/frontend/{design package}/{theme}/layout/local.xmltry with this code:
Regards
I believe if you change:
to
that should allow you to access theme specific javascript file.
If you want to
include javascript in
themethen put this code in
your module's layout.xmlunder
default` tag.If you want to
include javascript for any particular controller
then put this code inyour module's layout.xml
like belowAnd put
custom-script.js
file underyourMagentoDirectory/js
folder.Please try this, i think this is the way to add our js/css files into the load.xml:
Best solution insert into local.xml file with reference name="head"