Search This Blog

Mind freaker Stuff

Please Visit my new blog http://www.mindfreakerstuff.com for new articles related to web and mobile designing.

Friday, September 30, 2011

Magento: Add Javascript or CSS to Home Page Only (Or Any CMS Page)

CMS pages in Magento allow you to modify the layout XML specific to that page. So, all you need to do is open up the CMS page in Magento that you want to add the javascript to, click on the “Custom Design” tab on the left, and in the “Layout Update XML” field add the following:



“Custom Design” tab on the left, and in the “Layout Update XML” field add the following:
<reference name="head">
  <action method="addItem">
    <type>skin_js</type><script>yourfile.js</script>
  </action>
</reference>
 
Or, if you want to just put the javascript in the /js/ directory of your app, you can change the “skin_js” to just “js”.

Ref - http://prattski.com/2010/03/08/magento-add-javascript-to-home-page-only-or-any-cms-page/

12 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Digital Marketing is something that will suit anyone. Right from graduates, sales/marketing professionals, housewives looking for a work at home option or those freelancing enthusiasts. By the way, nice article. Like the way you organised the content.

    SEO Training In Chennai

    ReplyDelete
  3. Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post.
    Mason Soiza

    ReplyDelete
  4. Your site is truly cool and this is an incredible moving article. Much obliged to you to such an extent.
    css beautify

    ReplyDelete
  5. Me2call4u is free Video chat, video call app is ideal for one-to-one conversations that you can meet and match fun and interesting single all over the world in seconds.

    ReplyDelete