Home :: Learning HTML :: Counters
Contents:
We'll start out with a random piece of HTML used to make a counter in order to describe what's going on. Some various options can be seen later in Counter Examples.
Example HTML from the Staff & Organization Development Home Page, located at
http://www.madison.k12.wi.us/sod/index.htm
<IMG SRC="/Count.cgi?df=sod.index.htm&ft=0&dd=B&pad=0" HEIGHT="20" ALT="At least 4000"> visitors since November 10, 1997.
The name of the program we use is "Count.cgi" (notice the capital "C"). Anything after the "?" are options you can set to affect the appearance of the counter. Options are separated by ampersands; remember, ampersands are special characters, so they need to be written as &. The most important option is "df". Every counter needs the option "df" set. "df" sets the name of a file which holds the number of hits the counter on the document has received. Therefore it is also important that each counter has a unique value of "df". In the example above, "df" is set to "sod.index.htm". We've developed a system so that each document can have a unique counter.
In the example, the counter is on the document at
http://www.madison.k12.wi.us/sod/index.htm and the counter's "df" is set
to equal "sod.index.htm". This follows the pattern:
http://www.madison.k12.wi.us/sod/index.htm
http://www.madison.k12.wi.us/; e.g. sod/index.htm
/) to periods (.); e.g. sod.index.htm
This way, since all documents have unique URLs, they will also have unique "df"s.
A Web document named "afrlands.htm" is published in category "webpub_01".
http://www.madison.k12.wi.us/webpub/01/afrlands.htm
df=webpub.01.afrlands.htm
<IMG SRC="http://www.madison.k12.wi.us/Count.cgi?df=webpub_01.afrlands.htm" ALT="">
A Web document named "afrlands.htm" is published in a directory name "sstudies" of category "east".
http://www.madison.k12.wi.us/east/sstudies/afrlands.htm
df=east.sstudies.afrlands.htm
<IMG SRC="http://www.madison.k12.wi.us/Count.cgi?df=east.sstudies.afrlands.htm" ALT="">
For each counter, notice the counter's "df" is "webpub.advanc40.htm"; that's because
this page's address is http://www.madison.k12.wi.us/webpub/advanc40.htm.
Notice, also, that there are no spaces in the options and options are separated by the
text "&" (no quotes).
Since counters are images, they require ALT text. However, coming up with ALT text for a constantly changing graphic can be difficult, to say the least. If the page is updated frequently, you could put the current number of hits rounded down to the nearest 50 or 100. Otherwise, you could use ALT="" or ALT="lots", ALT="some", etc.
One last thing: Counters cannot be reset. If you'd like to remove a counter
and start a new one on a document, just give the "df" a new name by adding .2
to the end; e.g. from df=webpub.index.htm to df=webpub.index.htm.2
<img src="http://www.madison.k12.wi.us/Count.cgi?df=webpub.advanc40.htm" ALT="">
Add the option ft=1. Add an & to separate options.
<img src="http://www.madison.k12.wi.us/Count.cgi?df=webpub.advanc40.htm&ft=1" ALT="">
Add the option ft=n (n = width of frame in pixels). Add an & to separate options.
<img src="http://www.madison.k12.wi.us/Count.cgi?df=webpub.advanc40.htm.&ft=15" ALT="">
Add the option pad=0. Add an & to separate options.
<img src="http://www.madison.k12.wi.us/Count.cgi?df=webpub.advanc40.htm&pad=0" ALT="">
Add the option st=n (n = starting number of count). Add an & to separate options.
<img src="http://www.madison.k12.wi.us/Count.cgi?df=webpub.advanc40.htm&pad=0&ft=10&st=900" ALT="">
Add the option dd=X, where X = A, B, C, D, or E. There are 5 sets of graphics; each is represented by a letter. Note that the letters must be capitalized. Add an & to separate options.
<img src="http://www.madison.k12.wi.us/Count.cgi?df=webpub.advanc40.htm&pad=0&dd=C" ALT="">
Previous: Special Characters
Next: Image Maps
Home:: Learning HTML :: Counters
Home |
Policies |
HTML |
FAQ
Publishing |
Booklet |
Tools |
Links