ElkArte Community

Project Support => Support => Topic started by: Mrs. Chaos on September 13, 2017, 02:42:19 pm

Title: How can I embed a visitor counter?
Post by: Mrs. Chaos on September 13, 2017, 02:42:19 pm
Hello!
Is there a way to embed a visitor counter in the footer of the forum?
In my SMF forum it was no problem with the following code, but in my ElkArte test forum it causes just a "Template Parse Error".

From my counter hoster I have these code lines.
For the head area:
Code: [Select]
<script language="javascript" type="text/javascript">
  var _pID = "UID-123456-001";
</script>
<script language="text/javascript" type="text/javascript" src="http://counter.anbieter.de/counter.js"></script>

and for the body area:
Code: [Select]
<span id="counterdata"></span>

How must I add this in the ElkArte index.template.php?
The counter should appear - separated by a vertical divider - to the right of the word "credits" or in a new line below it. Like it's to see on the image.
Title: Re: How can I embed a visitor counter?
Post by: emanuele on September 13, 2017, 04:55:28 pm
Something like search for:
Code: [Select]
					theme_copyright(), '
</li>',
and replace it with:
Code: [Select]
					theme_copyright(), '
</li><script language="text/javascript" type="text/javascript" src="http://counter.anbieter.de/counter.js"></script><span id="counterdata"></span>',
should do... I think.
Title: Re: How can I embed a visitor counter?
Post by: Mrs. Chaos on September 14, 2017, 08:18:26 am
Um, no, it didn't work on this way. The counter didn't appear.
I added then the first part again in the head area and just left the  </li><span id="counterdata"></span>',  there.
Something similar I tried before, but apparently I did a mistake with the apostrophes and the commas…
Now the counter is on the desired place. :)
Title: Re: How can I embed a visitor counter?
Post by: emanuele on September 14, 2017, 11:41:53 am
Cool! :D