[SOLVED] Hit Counter code placement in G2

cookamunga
cookamunga's picture

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>

----

Gallery URL (optional): http://ginab.net/photos
Gallery version: 2

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-03-21 09:53

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.

 
cookamunga
cookamunga's picture

Joined: 2002-09-04
Posts: 15
Posted: Mon, 2005-03-21 16:41

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

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-03-21 17:25

wrap your whole section in {literal} ... {/literal} so smarty won't try to parse it.

 
cookamunga
cookamunga's picture

Joined: 2002-09-04
Posts: 15
Posted: Mon, 2005-03-21 18:43

Works like a charm! Thank you! :D

-Gina

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Mon, 2005-10-03 09:46

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.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Mon, 2005-10-03 19:46

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

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Mon, 2005-10-03 20:12

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.