I have created a custom module on frontend that is showing data from DB on now i want to add jquery and style sheet to my custom module front page.

I have tried like this through my layout xml but it is not including.

<?xml version="1.0"?>   
  <layout version="0.1.0">   
        <reference name="root">   
           <action method="setTemplate"><template>page/1column.phtml</template></action>   
        <reference name="content">   
           <block type="reviews/index" name="reviews_index" template="reviews/index.phtml"/>   
         <reference name="head">
            <action method="addItem">

  • Which file is not including? reviews.js? – tjons Nov 28 '16 at 21:16
  • i have updated the question yes it is – Xabby Nov 28 '16 at 21:17

If the JS is contained in the skin files, you need to use addItem('skin_js', 'path/relative/to/jsdir.js'). In your case, it would be like this:

<action method="addItem">
  • it is here: skin\frontend\rwd\default\js\reviews – Xabby Nov 28 '16 at 21:20
  • Ah. Well, then, you have to use addItem('skin_js') – tjons Nov 28 '16 at 21:21
  • like this: <action method="addItem"><type>skin_js</type><name>reviews/reviews.js</name></action – Xabby Nov 28 '16 at 21:23
  • @Xabby yep. Just like that. – tjons Nov 28 '16 at 21:24
  • Except don't forget the closing > after the action. Does that work? – tjons Nov 28 '16 at 21:25

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.