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

JS is not defined
 
the_musician
Jr. Member
 
Total Posts:  2
Joined:  2008-07-21
 

Hello,

I am trying to add a block to the left sidebar within my store. It uses some javascript to parse an rss feed. It works great outside of Magento, however upon integration I run into trouble.

I have included the js in page.xml and it shows up in the proper location in the head portion of the html. However the script will not run as it throws an error saying the function is not defined. This tells me that the JS is not actually being written into the final compiled js file.

I added it in page.xml with the following line,

<action method="addJs"><script>js/rssticker.js</script></action>

The file is located in the following location: skin\frontend\blank\theme056\js\rssticker.js

Where have I gone astray?

Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

Try and move the file to the js directory located at the root of your installed Magento.

 
Magento Community Magento Community
Magento Community
Magento Community
 
the_musician
Jr. Member
 
Total Posts:  2
Joined:  2008-07-21
 

Thank you very much. I did indeed have to move it to the root js folder. After doing so I needed to remove the js directory from my page.xml file.
The final snippet looked like this:

<action method="addJs"><script>rssticker.js</script></action>

Thank you again for the help.

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