|
Have you ever wondered how to
use a counter on your own pages? The remainder of
this document explains exactly how to accomplish
this if you are using www.brown.edu to publish your
documents.
- The file to contain the counter
must have an extension of .shtml or you must
create a .htaccess file. If you don't, then you'll
get nothing where the counter should be.
- Place a tag exactly like the
following in your document at the location where
you want the number to appear:
<!--#exec cgi="/cgi-local/counter"-->
This will give a cardinal number. If you prefer an
ordinal number (such as 23rd) then substitute counter-ord
for counter in the above example.
- Your page should now have a
working counter.
How is this working?
This counter works through
what are known as "server side includes". Normally
the server sends out your HTML document as-is. With
an .shtml file the server parses the document
first looking for various special operations.
Can the counter be used in regular .html files?
Yes, just follow the
directions in
Server-side
Includes
. Besides page counters, server
side includes are often used to include documents
inside other documents (such as a standard header
or footer) and to have automatically updated "last
modification" times.
Can I reset the counter to zero?
Change your include to
reference counter-z. The next time you
access the page you will see a zero, the counter
will be reset and you can change back to your preferred
counter format.
Can the counter be accessed
from another server?
Unfortunately not. Because of the way the counter works it can only be used
from documents that reside on www.brown.edu.
How accurate is the counter?
It should accurately
reflect how many times your document has been retrieved
from our server. However, not all access to your
document will be reported to our server. Many proxy
servers and many commercial providers (including
America On-Line) locally cache documents to provide
better response to their users and to protect the
Internet from the full impact of their often vast
number of subscribers. It is possible for a million
accesses from one such place to appear as only one
access to our server. This issue is being addressed
by standards committees and might change in a few
years.
The following is a complete
list of possible counter types.
- counter
- counter-ord
- counter-nc
- counter-nc-ord
- counter-nd
- counter-z
Those containing the string
'-ord' display an ordinal rather than a cardinal
number. Those containing '-nc' display the counter
but do not increment it. Those containing '-nd'
increment but do not display the counter. Those
containing a '-z' set the counter to zero.
|