Adding counter script to footer

Started by loplo, March 10, 2012, 05:48:40 AM

Previous topic - Next topic

loplo

Hey guys,
I'm trying to add this code to my footer and I can't make it.
<!--/Start async trafic.ro/-->
<script type="text/javascript" id="trfc_trafic_script">
//<![CDATA[
t_rid = 'fly-ra-com';
(function(){ t_js_dw_time=new Date().getTime();
t_js_load_src=((document.location.protocol == 'http:')?'http://storage.':'https://secure.')+'trafic.ro/js/trafic.js?tk='+(Math.pow(10,16)*Math.random())+'&t_rid='+t_rid;
if (document.createElement && document.getElementsByTagName && document.insertBefore) {
t_as_js_en=true;var sn = document.createElement('script');sn.type = 'text/javascript';sn.async = true; sn.src = t_js_load_src;
var psn = document.getElementsByTagName('script')[0];psn.parentNode.insertBefore(sn, psn); } else {
document.write(unescape('%3Cscri' + 'pt type="text/javascript" '+'src="'+t_js_load_src+';"%3E%3C/sc' + 'ript%3E')); }})();
//]]>
</script>
<noscript><p><a href="http://www.trafic.ro/statistici/forum.fly-ra.com"><img alt="forum.fly-ra.com" src="http://log.trafic.ro/cgi-bin/pl.dll?rid=fly-ra-com" /></a> <a href="http://www.trafic.ro/">Web analytics</a></p></noscript>
<!--/End async trafic.ro/-->


I've edited index.template.php, tried to insert he code before </body> or after template_body_below() and I'm getting: syntax error, unexpected T_STRING, expecting ',' or ';'

What to do?
I know there are some mods out there, but I'm not passing the test while installing and I'm afraid to mess around with the code.

Any help appreciated.

Aleksi "Lex" Kilpinen

You need to make sure you escape all single quotes in the code. So change all ' to \'
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

loplo

So my code became:
<!--/Start async trafic.ro/-->
<script type="text/javascript" id="trfc_trafic_script">
//<![CDATA[
t_rid = '\fly-ra-com'\;
(function(){ t_js_dw_time=new Date().getTime();
t_js_load_src=((document.location.protocol == '\http:'\)?'\http://storage.'\:'\https://secure.'\)+'\trafic.ro/js/trafic.js?tk='\+(Math.pow(10,16)*Math.random())+'\&t_rid='\+t_rid;
if (document.createElement && document.getElementsByTagName && document.insertBefore) {
t_as_js_en=true;var sn = document.createElement('\script'\);sn.type = '\text/javascript'\;sn.async = true; sn.src = t_js_load_src;
var psn = document.getElementsByTagName('\script'\)[0];psn.parentNode.insertBefore(sn, psn); } else {
document.write(unescape('\%3Cscri'\ + '\pt type="text/javascript" '\+'\src="'\+t_js_load_src+'\;"%3E%3C/sc'\ + '\ript%3E'\)); }})();
//]]>
</script>
<noscript><p><a href="http://www.trafic.ro/statistici/forum.fly-ra.com"><img alt="forum.fly-ra.com" src="http://log.trafic.ro/cgi-bin/pl.dll?rid=fly-ra-com" /></a> <a href="http://www.trafic.ro/">Web analytics</a></p></noscript>
<!--/End async trafic.ro/-->


I've inserted the code before </body> and no joy, still getting the error.
Did I change to much? Did I put the code it in to the wrong place?

Aleksi "Lex" Kilpinen

' becomes \' not '\ like you did there ;)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

loplo

My bad.
It really works! Thanks for helping me out.

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: