carplu Posted August 26, 2014 Share Posted August 26, 2014 Hi for a retargeting campaign i need to add a script to the head of every page how do i do that? Thanks Link to comment Share on other sites More sharing options...
PSfever.com Posted August 26, 2014 Share Posted August 26, 2014 You will need to add the script inside of header.tpl of the theme that you're using. Link to comment Share on other sites More sharing options...
carplu Posted August 26, 2014 Author Share Posted August 26, 2014 thought so too but for some reason when i add it in themes header.tpl before </head> tag and view source code i am not seeing it Link to comment Share on other sites More sharing options...
carplu Posted August 26, 2014 Author Share Posted August 26, 2014 i put it in a html block now... that seemed to work Link to comment Share on other sites More sharing options...
PSfever.com Posted August 26, 2014 Share Posted August 26, 2014 Or you can do that..however I believe that inserting this code directly in header.tpl is better, as html module servers better if you want to change the code often. Also this way, PS has to call a module, juts for few lines of code. It's not even hard Link to comment Share on other sites More sharing options...
carplu Posted August 26, 2014 Author Share Posted August 26, 2014 I know it's not hard (shouldn't be) but when i add the code to theme's header.tpl i do not see it in the source code which is very strange Link to comment Share on other sites More sharing options...
bellini13 Posted August 26, 2014 Share Posted August 26, 2014 do you have smarty re-compile disabled? Link to comment Share on other sites More sharing options...
carplu Posted August 26, 2014 Author Share Posted August 26, 2014 smarty never re-compile templates cache yes Link to comment Share on other sites More sharing options...
bellini13 Posted August 27, 2014 Share Posted August 27, 2014 Ok, so think about this for a minute. If you change a smarty template (header.tpl), then that has to be recompiled for the changes to take effect. Now you have smarty re-compile disabled (never re-compile templates). So what do you think would occur? Link to comment Share on other sites More sharing options...
El Patron Posted August 27, 2014 Share Posted August 27, 2014 what is your front office url? under bo-->advanced-->performance is JavaScript being loaded bottom or top? Link to comment Share on other sites More sharing options...
carplu Posted August 27, 2014 Author Share Posted August 27, 2014 Ok, so think about this for a minute. If you change a smarty template (header.tpl), then that has to be recompiled for the changes to take effect. Now you have smarty re-compile disabled (never re-compile templates). So what do you think would occur? When i switch on force compile i just see a blank page... if i change it back again i see the page but no script Link to comment Share on other sites More sharing options...
carplu Posted August 27, 2014 Author Share Posted August 27, 2014 what is your front office url? under bo-->advanced-->performance is JavaScript being loaded bottom or top? Sorry can not find what you mean Link to comment Share on other sites More sharing options...
El Patron Posted August 27, 2014 Share Posted August 27, 2014 Sorry can not find what you mean what version of ps are you using? (less than 1.6.0.7?) Link to comment Share on other sites More sharing options...
carplu Posted August 27, 2014 Author Share Posted August 27, 2014 what version of ps are you using? (less than 1.6.0.7?) yep 1.06.05 Link to comment Share on other sites More sharing options...
El Patron Posted August 27, 2014 Share Posted August 27, 2014 yep 1.06.05 then possible you not see your .js file as it will be moved bottom (all your java is moved to bottom in this version) even if added to header.tpl Link to comment Share on other sites More sharing options...
carplu Posted August 27, 2014 Author Share Posted August 27, 2014 nah... when i add it to header or footer it was nowhere in the source code neither in bottom, when added to the html block it is in bottom so i think i'll leave it there... if it works it works :-) and this way i won't have to remember putting it back when an update will be executed Link to comment Share on other sites More sharing options...
El Patron Posted August 27, 2014 Share Posted August 27, 2014 nah... when i add it to header or footer it was nowhere in the source code neither in bottom, when added to the html block it is in bottom so i think i'll leave it there... if it works it works :-) and this way i won't have to remember putting it back when an update will be executed is this included in CCC'ed .js files or is it standalone, i.e. called by itself at bottom? (see source code) Link to comment Share on other sites More sharing options...
carplu Posted August 27, 2014 Author Share Posted August 27, 2014 i don't know i have added it to the themes header.tpl and also tried footer.tpl when viewing source code using cmd +f to find the script it was not there when i do it by using the html block it is in footer i have all options in admin/advanced/performance regarding ccc etc. set to yes Link to comment Share on other sites More sharing options...
El Patron Posted August 27, 2014 Share Posted August 27, 2014 i don't know i have added it to the themes header.tpl and also tried footer.tpl when viewing source code using cmd +f to find the script it was not there when i do it by using the html block it is in footer i have all options in admin/advanced/performance regarding ccc etc. set to yes it's simple to check, simply turn off java CCC and check source. or click on the CCC'ed java call it will show you the java inside. Link to comment Share on other sites More sharing options...
bellini13 Posted August 27, 2014 Share Posted August 27, 2014 When i switch on force compile i just see a blank page... if i change it back again i see the page but no script thats good, it means your change is now being applied. The blank page means you are receiving an error. Most likely you are using javascript code that needs to be 'cleansed'. try placing your code within smarty literal tags... {literal} ...your javascript goes here {/literal} 3 Link to comment Share on other sites More sharing options...
Recommended Posts