Vgradimo števec
FYI:This tutorial refers to the use of a CGI application
or Common Gateway Interface. You will need to attach to one to make it
work. Chances are your server has one. I'll explain further as I go on.
...use these links to jump around or read it all!
[Why Do You Want This Counter?][What
Is A Counter?][The Format Of A Counter]
[Three Ways To Get A Counter][The
Best Way][The Next Best Way][This
will Work Too]
You are the
person to ask me that!
This is without a doubt the number one item
people ask me about. Everyone wants a counter. Why? I don't know. My guess
is because someone else has one. I don't have a lot of room to talk. I
have one.
If you have already attempted to surf
the net in order to find a nice easy page telling you how to put up a counter,
you have probably encountered something that uses words like: Bitmap,
Stadealone Daemon, Config File, and Inetd. Right?
Not exactly an easy "how to."
Here's the reason the pages are so darn
technical. Counters are technical. It's a fact of Internet life. If you
have already read my
tutorial on Image Maps you are already familiar with the concept of
a CGI application or Common Gateway Interface.
This is a little program that sits deep in the guts of an Internet server
and does tricks like make an Image Map work or count the number of visitors
to your page.
The highly technical pages on counters
are actually very good. I have read a great many of them. Silicon
Graphic's page on counters is readable as is this
one. The problem is both of the pages expect you have the ability to
get into the guts of the server and place a CGI application. My guess is
that if you're reading this, you don't have that ability. You simply want
a counter on your page.
Sorry About This...
Now here's the information you didn't want to
read...I cannot give you a set command that plops a counter in place. What
I can do is tell you how to go about finding the command that will
plop the counter on your page. Stay with me here and I'll get you a little
closer to having a counter than you were when you began reading this page.
Why Do You Want This Counter Anyway?
Counters look great - granted. However they do
have several drawbacks:
-
It slows the completion of the page
-
If the counter CGI is down, the page transfer comes to a complete stop
-
Counters can be faulty and count incorrectly
-
The viewer might have their in-line images turned off thus never ever seeing
your count
-
...and honestly - how good does a counter look that only reads 15?
If I haven't talked you out of a counter, let's go on...
What Is A
Counter Anyway?
A counter is an image. In most cases, it's a bitmap.
Remember that word from above? Don't let it throw you. An image is an image,
is an image. It shows up on your page. However this little image comes
from the CGI that you attach to. Here's the command I use to get
a counter on my page:
<IMG SRC="http://www.htmlgoodies.com/cgi-bin/counter?width=5&link=
{http://www.htmlgoodies.com/} {counter.html}">
Looks pretty scary, huh? It isn't really. The
command is doing four things:
-
IMG SRC= is telling the computer that what will be returned from
the CGI will be an image. Where you place the counter command on the page
denotes where the image will fall.
-
"http://www.htmlgoodies.com/cgi-bin/counter? is the path (or URL
if you will) to the counter CGI.
-
width=5 is telling the CGI how large a counter to return
-
and{http://www.htmlgoodies.com/}{counter.html}" is the path back
to the page that should receive the counter.
The Format Of A Counter
This is the very basic format almost all counters
follow:
<IMG SRC="PATH TO THE COUNTER CGI/width=#&link=PATH
TO THE PAGE">
Since there are many different way to write
counter CGI's, the actual format that works for you may differ slightly
from the one above, but not too far. The concept is; it's an image - path
to the CGI - how big do you want it - path back to the page.
I have seen some counter formats that do not have the WIDTH command
and others that do not enclose the PATH TO THE PAGE in the { } brackets
- but for the most part, this is the format.
I told you this get's technical.
Please Note: The format above works for
my server and my server alone. You might think - (Spoken
with evil British accent) "Hah! The fool! He has given us the path to his
counter CGI! I shall change the information in the command with my page's
address so the counter will return a bitmap to me!!! Ha ha ha ha ha ha!(end
British accent).
No dice.
You see, Webmasters who write these little counter
CGI's know they are very popular. In turn - as is the case here
- the CGI will be written so that unless you are on the same server as
the CGI, you will get a nasty message back. Here's what you'll get if you
attach to the CGI noted above:
Counter Only Counts Our Pages
Ok, Joe. You're beginning to anger me! Can I get a counter or not?
Sure you can. Here are three ways. All three
will work. One is just better than another..
Three Ways To A Counter
Find Your Own - Best Way!
Always an easy answer, huh Joe? Well, yes. It
could very well be that the Webmaster of your server has a little CGI waiting
just for you. All you have to do is attach to it. Contact him/her and ask.
Or you can surf around to other pages on your own server and see how they
got their counters to work, then follow the paths they laid out. My guess
is that - if you're on a server of any size or on a server that allows
Image Maps - there's a counter CGI just waiting for a nice page like yours.
Go To A Public Domain Counter CGI - Not So Best Way
They have those things?!?!?! Yeah, they have them.
They are very over-taxed and can slow your page considerably, but they're
out there.
Well, darn it! - I happen to have a couple right here! Page
Count and Webtool's Counter.
These are nice sites that allow you to choose
the type of counter you want and then allows you to fill out a form that
hands you the IMG format to place on your page. Read it over carefully
before attaching! There are costs if your site gets more that 1000
hits a day and they make no commitment that the counter will work every
time.
Attach To Someone Else's Counter -
Not So Good But It'll Work
ASK PERMISSION! ASK PERMISSION! ASK PERMISSION!
I wanted to get that in first rather than have
is get lost at the end of this page. Remember a little while back in this
page where I have you talk in the sinister British voice and say that you'll
just attach to my counter by just changing the command line from my page?
Well, that's not too far from what you can do. BUT...
ASK PERMISSION! ASK PERMISSION! ASK PERMISSION!
If you see a page that has a counter on it
- look at the page's source. (You can see it's source by opening SOURCE
under the VIEW menu at the top of the page) Look for the IMG command that
put the counter on the page. The path to the counter CGI is going to be
a URL. Take just the main URL address (before all the //// directories)
and log in. The main page will more than likely have blue words that allow
you to write to the webmaster.
Write and ask for permission
to make an attachment the counter.
Disclaimer
I DID NOT just tell you to go and attach to
counters at will until you find one that works! Doing that can really tee
off webmasters who put a great deal of work into assisting their own server's
patrons.
Although you might get a counter for a short
while, if you tee off the webmaster you can be locked out just that quick.
Be nice - ask. I'll bet you get a nicer note than if the webmaster sees
you using the counter CGI without permission.
Well, that's about all I can tell you.
I know it's not a direct answer, but it will at least send you in the right
direction. First ask yourself if you really want this counter thing. If
so - do the legwork! It'll pay off. You'll get a nice counter sitting right
where you want it.