Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

adding hit counter

Asked Modified Viewed 5,686 times
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
asked
Member

what page would i put the code for a hit counter so it is logging as soon as someone visits: mysite/news.php

Thanks for any help
0 replies

18 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Admin >>> Settings >>> Main

Scroll down to Footer.
Paste your code.
Save.
0 replies
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

the code is javascript, and part of the code is showing at the footer
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Ok sure the file you need to look at is themes/templates/footer.php

Add the javascript before the </footer> tag.
0 replies
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

thanks Fanagree!
0 replies
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

there is not </footer> in there
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Then before...

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "</body>\n</html>\n";[/syntaxhighlighter]

Like this...

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo"<--YOUR HITS COUNTER --->";
echo "</body>\n</html>\n";[/syntaxhighlighter]
0 replies
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

getting this error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/mysite/public_html/themes/templates/footer.php on line 25
0 replies
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
answered
Veteran Member

Either insert the JavaScript-code like this:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]?>
<--YOUR HITS COUNTER --->
<?php
echo "</body>\n</html>\n";[/syntaxhighlighter]
- or else convert the JavaScript-code to PHP-Code and do what @FC told you.
0 replies
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

here is the code:

<!-- Start of Counter Code -->
<script type="text/javascript">
var sc_project=6653259;
var sc_invisible=1;
var sc_security="748e39d7";
</script>

<script type="text/javascript"
src="http://www.counter.com/counter/counter.js"></script><noscript><div
class="counter"><a title="visit tracker on tumblr"
href="http://counter.com/tumblr/" target="_blank"><img
class="counter"
src="http://c.counter.com/6653259/0/748e39d7/1/"
alt="visit tracker on tumblr" ></a></div></noscript>
<!-- End of Counter Code -->
0 replies
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
answered
Veteran Member

Look up.. ;)
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo"<!-- Start of Counter Code -->
<script type='text/javascript'>
var sc_project=6653259;
var sc_invisible=1;
var sc_security='748e39d7';
</script>

<script type='text/javascript'
src='http://www.counter.com/counter/counter.js'></script><noscript><div
class='counter'><a title='visit tracker on tumblr'
href='http://counter.com/tumblr/' target='_blank'><img
class='counter'
src='http://c.counter.com/6653259/0/748e39d7/1/'
alt='visit tracker on tumblr' ></a></div></noscript>
<!-- End of Counter Code -->\n";
echo "</body>\n</html>\n";[/syntaxhighlighter]
0 replies
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

I put exactly as you have here FC and still get parse error on line 26. which is line 2 above.
Edited by free1301 on 07-01-2011 21:27,
0 replies
F
free1301
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
answered
Member

Thanks Smokeman your code worked! ;)
0 replies
S
SimpleVision
S
  • Member, joined since
  • Contributed 63 posts on the community forums.
  • Started 11 threads in the forums
answered
Member

$59 for a counter? :o
0 replies
M
MarcusG
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
answered
Member

Why don't you use the file which is made for footer includes?

INCLUDES/footer_includes.php, no need to edit the theme/templates/footer.php because at the next update your changes are gone!
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Comply!
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

As the Master Coders posted above ;) , I also want to say that you have to use single Quotes (') in any extra HTML code you are adding...
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Is there no add_to_footer function??
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 18 posts
  • Votes 0 votes
  • Topic users 7 members

7 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
F
F
  • Member, joined since
  • Contributed 66 posts on the community forums.
  • Started 25 threads in the forums
  • Started this discussions
S
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
M
M
Ex Senior Dev.
  • Member, joined since
  • Contributed 182 posts on the community forums.
  • Started 5 threads in the forums
S
S
  • Member, joined since
  • Contributed 63 posts on the community forums.
  • Started 11 threads in the forums
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet