Classy Counters

Permabanned
Joined
22 Apr 2007
Posts
1,805
Ok, I know I know, but my client WANTS a web counter at the bottom of his index page and I want it to look classy and in line with the rest of the site. Not some huge lime green rotating fruit machine.

Is there a way to actually code it, or am I confined to 'downloading' a free one.

Ta
 
Umm thanks but I'm a php newb really

I've uploaded two files to my directory

counter.php with the script and hitcounter.txt

and i've included

Code:
<?php
include ("counter.php");
?>

In the < head > of my site.

Doesnt seem to work :(
 
Ok, moved to withing <body> at the top

still, when I open or download hitcounter.txt, it's empty

Does it matter that my site is built entirely in HTML?

I do have a php through my web host though
 
well the file needs a .php extension to be parsed as php (otherwise the php include function won't work). but of course the php page can contain normal html. :)

Ok, so now I have index.php but still nothing appears in hitcounter.txt

:(

Am I missing a trick here?
 
Oh, now I get this at the top of the page

Warning: fopen(hitcounter.txt) [function.fopen]: failed to open stream: Permission denied in /home/mark1e/public_html/langham/counter.php on line 5

Warning: fputs(): supplied argument is not a valid stream resource in /home/mark1e/public_html/langham/counter.php on line 6

Warning: fclose(): supplied argument is not a valid stream resource in /home/mark1e/public_html/langham/counter.php on line 7
1

I've also changed the file attributes for counter.php but still the same error

EDIT:

OK, altered the file permissions of hitcounter.txt too and now it works, BUT, the count appears in the top left hand corner of the homepage
 
well you need to place the include wherever you want it to be in your html. you can open/close php tags anywhere in the html. in a div/table/wherever.... it's upto you.

I thought the point was that it wrote to a file that could be viewed but didnt appear on the website?
 
now i'm -> :confused: what are you on about? :p

the script itself updates the text file with every hit. it also outputs the count as html to the screen (see the echo command). treat this number as content and place it wherever you want it to appear in the page.

No its cool. I just wanted it hidden from view as I think they look nasty, but I've stuck it subtly in the footer and all is well.

Thanks again ;)
 
Back
Top Bottom