Jump to content

javascript in header file breaks webpage


Recommended Posts

I am trying to add code for sharethis buttons directly to the header/footer file but for some reason its not liking the scripts at all and seems to break the page. I am adding the javascript directly into the header section just below hook_header.

 

I was expecting this just to work but unfortunately its a no go, am I doing something wrong here, is there a proper way to do this?

Link to comment
Share on other sites

Thats actually good news, atleast I know I can add custom jscript directly into the header.tpl, now Im wondering if its not my app but my host provider setup somehow crashing things...

 

Im wondering if its a permission error of some sorts as the script does access an external site

Link to comment
Share on other sites

The JS could be conflicting with another script. Try placing the script in the footer (so it loads last) and see if that still causes the issue, my bets it will.

 

Have you set the site to work with your root i.e? yourdomain.com and your working with script on yourdomain.com/devfolder that can be a nother cause for it...

 

There is a sharethis module for prestashop

Edited by cocothecat (see edit history)
Link to comment
Share on other sites

Thanks coco, you are correct, I loaded the script in the footer section and the results the same, a blank page, just to test your theory even further I placed the code in an html file on my root directory and iframed it into the page and everything worked perfectly, accept for loading an iframe inside an iframe it would be a suitable option

 

Im not quite understanding the directory advice you gave though, the script has been inserted into the header.tpl inside the themes folder (domain.com/themes/nzstore/header.tpl) and the page im loading is the index.php page

 

Yeah Im thinking about using the module option the only downside being is im going to have to create a new hook to get it to show where I want it, not a biggie but Im trying to avoid any core component changes

Link to comment
Share on other sites

×
×
  • Create New...