2

I've some scripts in magento due to the confliction of the below, it is causing some glitch. I need to dig into the below scripts, so that I can find what is the causing the error. Where can I find the files of below code?

<?php echo $this->getCssJsHtml() ?>

1 Answer 1

1

In your case $this is an instance of Mage_Page_Block_Html_Head. You will find the method getCssJsHtml in that class.
This method generates the html for the css and js files added to the <head> tag.

In order to add a js file to the head tag you can add this to one of the layout files

<page_handle_here>
    <reference name="head">
        <action method="addJs"><file>path/to/js/relative/to/js/folder.js</file></action> 
    </reference> 
</page_handle_here>

to add a css file:

<page_handle_here>
    <reference name="head">
        <action method="addCss"><file>path/to/js/relative/theme/folder.css</file></action> 
    </reference> 
</page_handle_here>
2
  • I've added my below code in /app/design/frontend/default/mytheme/layout <reference name="head"> <action method="addJs"><file>js/lib/jquery-1.10.2.min.js</file></action></reference> Jan 12, 2015 at 9:15
  • @user2366892. you need to wrap your code in a page handle. If you want that available for all the pages wrap it between <default>YOUR XML HERE</default>.
    – Marius
    Jan 12, 2015 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.