Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

skinJs bug? 
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

what im trying to do: add a custom js file from a custom theme named ‘second_theme’

when adding this line:

<action method="addItem"><type>skinJs</type><name>test.js</name></action>

to page.xml, i get this returned in the html source:

<script type="text/javascript" src="http://magento.dev/skin/frontend/default/second_theme/js/test.js" ></script>
<link type="text/css" rel="stylesheet" href="http://magento.dev/skin/frontend/default/default/css/test.js" ></link>

why does it try and also add the test.js as css as well?

on closer inspection of app/code/core/Mage/Page/Block/Html/Head.php i see this:

switch ($item['type']{
     
case 'js':
          
$lines .= '<script type="text/javascript" src="'.Mage::getBaseUrl('js').$item['name'].'" '.$item['params'].'></script>';
     break;

     case 
'skinJs':
          
$lines .= '<script type="text/javascript" src="'.$this->getSkinUrl('js/'.$item['name']).'" '.$item['params'].'></script>';

     case 
'css':
          
$lines .= '<link type="text/css" rel="stylesheet" href="'.$this->getSkinUrl('css/'.$item['name']).'" '.$item['params'].'></link>';
     break;
}

shouldn’t there be a ‘break;’ for the skinJs case as well?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

great catch!

Edit Mage_Page_Block_Html_Head and add after line 96 “break;” before “case ‘css’:”

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott
Guru
 
Avatar
Total Posts:  333
Joined:  2007-08-31
Northwest Ohio
 

Tried using this skinJs type, and it’s still appending to the js packer:

<script type="text/javascript\" src="../index.php?c=auto&f=,prototype/prototype.js,prototype/validation.js,scriptaculous/builder.js,scriptaculous/effects.js,scriptaculous/dragdrop.js,scriptaculous/controls.js,scriptaculous/slider.js,varien/js.js,varien/form.js,varien/menu.js,mage/translate.js,mage/cookies.js,varien/product.js" ></script>

I thought this was the way to do it. Has something changed?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top