Question

I'm creating a static block to show custom menus and calling this static block inside topmenu.phtml. Now I want to write some javascript code which will be applied on the ids/classes present in that static block. How I can link my static block to js file where I can write my js/jquery code? I've tried this way but it didn't work.

<script  src="<?php echo $this->getSkinUrl('js/jquery-1.4.4.min.js');?>"></script>
<script  src="<?php echo $this->getSkinUrl('js/myfile.js');?>"></script>
Was it helpful?

Solution

To get the skin URL in cms page/static block.

{{skin url="your-path"}}

So now you can add script like below.

<script src="{{skin url="your-path"}}"></script>

Or else you can directly add script with in script tag

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top