Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to add a piece of JavaScript to a friends website which needs to be on every page. However looking on the backend of his site there is no were to add/edit the template he is using. (He isnt on Magento Go? He's on version 1.5)

So I asked him for his FTP details so I could edit the .phtml files in the template however there is no Magneto file structure on his FTP. However when you go to his site you can do "/skin/frontend" and the folders are present.

Could there be other FTP details, or levels of access that perhaps his website designers used?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Instead of modifying .phtml file you have to add javascript via XML layout. Here how you do it:

  1. You need to locate the which directories to use. To do so log into Magento admin interface, go to System\Configuration\Design and Check "Package" and "Default" values of 1st and 2nd options grops correspondently.
  2. Upload the JS file into skin/frontend/PACKAGE_NAME/THEME_NAME/js where PACKAGE_NAME is the value you found in "Package" field in step 1 and THEME_NAME is the value you found in "Default" field.
  3. Go to app/design/frontend/PACKAGE_NAME/THEME_NAME/layout and create a local.xml file with the following content:

    <?xml version="1.0."?>
    <layout version="0.1.0">
        <cms_page>
            <reference name="head">
                <action method="addJs"><stylesheet>js/YOUR_SCRIPT.js</stylesheet></action>
            </reference>
        </cms_page>
    </layout>
    

That's all. Don't forget to clear Magneto caches after all (Admin\System\Cache Management).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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