[SOLVED] Hit Counter code placement in G2
cookamunga
Joined: 2002-09-04
Posts: 15 |
Posted: Mon, 2005-03-21 07:54 |
Hello - I've just installed G2 and imported my G1 albums. VERY happy with it. One album was corrupt, but I just deleted the photo the installation hung on, re-imported the album, and everything worked like a charm. Okay - to my question. In G1, I had stuck some <script> tags for a hit counter in some of the HTML_WRAPPER files, and was wondering where you guys would suggest sticking this code in G2? I want to place the code on a page that loads with every page in Gallery so I can see where my users are clicking. Any suggestions would be appreciated! Thanks, Gina The code looks like: <script> var page_name = ''; function sE(){return true;}window.onError=sE;var lp=0; function clr(){lp++;if(lp==1){document.ctr.src="http://64.49.222.57/0.gif";} else {clearTimeout(myT);return true;}} var myT=setTimeout('clr()',120000);var rn=Math.random(); document.write('<a href="http://www.web-stat.com/stats.shtml?gina"'); document.write(' target="new"><img name="ctr"'); document.write(' src="http://www.web-stat.com/count.cgi?'); document.write('gina::'+top.document.referrer); if (window.screen){ document.write('::'+screen.width+'x'+screen.height+'::'); document.write(screen.colorDepth+'::'+page_name+'::::'+rn); }else{document.write('::::::page_name::::'+rn);} document.write('" onError="clr();" onAbort="clr();"'); document.write(' onLoad="clearTimeout(myT);"'); document.write('border=0 alt="Web-Stat hit counter"></a>'); </script>&&&&& <noscript> <a href="http://www.web-stat.com/stats.shtml?gina" target="new"> <img src="http://www.web-stat.com/count.cgi?gina::NoJavaScript" border=0> </a> </noscript>
---- |
|
Posts: 32509
see the instructions on the top of templates/global.tpl.
- create a folder templates/local
- copy templates/global.tpl to templates/local/global.tpl
- edit templates/local/global.tpl
at the bottom of the file, you see the html for the small images in the footer/at the bottom of all G2 pages. there you could add your counter html.
Posts: 15
Thanks for the fast response, Valiant!
I created the directory and tried adding the <script> to the file, but then when I view my Gallery I get this Smarty error:
Fatal error: Smarty error: [in gallery:templates/global.tpl line 67]: syntax error: unrecognized tag 'return' (Smarty_Compiler.class.php, line 576) in /home/ginabnet/public_html/photos/lib/smarty/Smarty.class.php on line 1088
I moved the <script> around to different places in the file, but it just resulted in different line errors.
Do I have to put some special <div> tags around the <script>? Or do something else special?
-Gina
Posts: 8601
wrap your whole section in {literal} ... {/literal} so smarty won't try to parse it.
Posts: 15
Works like a charm! Thank you! :D
-Gina
Posts: 210
I would like to edit sidebar.tpl of the hybrid-theme to add a counter of nedstat/Webstats4U below the language-selection.I don't find the part, which is related to language. My aim is to create a counter in the bottom of the sidebar.
Posts: 16504
Pinguin, you might have better luck posting your question in the the G2 Customization forum as a new topic and not in a topic that was marked soved over 6 months ago using the old layout/theme system.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 210
LOL, I searched the forum for my problems to show, that I don't ask without research before and thought that this thread is in the wrong categpry and now you told me, what I thought before.