|
|
| | Your cart is currently empty |
|
| |
|
  |
| Designing Web Pages Using MHTC's Counter CGI Script |
| |
MHTC offers
customers who host a domain on our Web server the use of a free CGI script
that adds a counter graphic to a Web page. This is useful for displaying the
approximate number of people who have visited your Web site. Each time the page
containing the graphic loads, the counter is incremented and the graphic is
updated. Below is an example of the most basic counter image, including the
HTML code necessary to generate it.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=usernam.dat"> |
To implement this most basic
counter, simply insert the HTML tag shown above into your HTML
code, and then the counter image will be displayed at that location
in the document. Please note that you must replace the word "username" in the HTML code with your unique
MHTC username. As you can see from the example above, the
HTML code is very similar to a basic image tag. The only difference
is that the "src" attribute calls a CGI program instead
of an image file. The CGI program, which resides on MHTC's
server, then increments the counter on the server, fetches the
appropriate image based on the new counter value, and sends that
image to the browser.
How to force your counter
to be updated:
After implementing your counter,
you might find that the value of the counter does not seem to
be updated, even though you are certain that people are hitting
your site. That may be because your Web browser is using an old
version of the counter graphic that is stored in its file cache.
There are two ways you can force the server to send you an updated
counter graphic: (1) Go to a different Web page on which the counter
is not displayed, and then empty your browser's cache of temporary
files. The next time you view the Web page with the counter, it
should be updated. (2) Alternatively, close your Web browser and
disconnect from the Internet. The next time you connect to the
Internet and view the Web page with the counter, it should be
updated.
How to adjust frame thickness:
You can adjust the thickness
of the frame around the counter by adding a "pipe" character
("|") followed by the string "ft=n" where the letter "n" is some non-zero integer
that represents the thickness of the border in pixels. If you
do not add the string, the default thickness is 10 pixels. If
you want to specify the thickness, add "ft=0" for no
border, "ft=5" for a border that is 5 pixels wide, "ft=20" for a 20-pixel border, etc. In the example below, the frame thickness
is specified to be zero pixels, or, in other words, no frame is
displayed.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|ft=0"> |
Note: As you add additional attributes to
your counter's HTML code, you must separate the attributes with
a "pipe" character, or a vertical-line character, as
shown in the example above..
How to adjust frame color: You can adjust the color of the
frame around the counter by adding a "pipe" character
("|") followed by the string "frgb=xxxxxx"
where the letters "xxxxxx" are a six-character
hexadecimal code for the color you desire, or you can even use
the English word for the color, like "red." If you use
a hexadecimal code, do not precede it with a pound sign (#), like
you do in some other situations that call for a hexadecimal color
code. If you do not add the string, the default color is blue.
In the example below, the frame color is specified to be red.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|frgb=FF0000">
or
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|frgb=red"> |
How to add a comma: You can customize the counter
so that a comma is added for counter values greater than 999.
Just add a "pipe" character ("|") followed
by the string "comma=T" to the HTML code. By default,
a comma is not displayed, so you must add the string of letters
if you want a comma to be displayed. An example appears below.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|comma=T"> |
How to rotate the graphic: You can customize the HTML code
for the counter so that the graphic is rotated 90 degrees clockwise,
90 degrees counter-clockwise, or 180 degrees (upside down). Just
add a "pipe" character ("|") followed by the
string "degrees=90" to rotate the graphic 90 degrees
clockwise, add the string "rotate=Y" to rotate the graphic
90 degrees counter-clockwise, or add the string "degrees=180"
to turn the graphic upside down. Of course, by default, the graphic
is not rotated at all. In the three examples below, the HTML code
is customized to achieve the three different types of rotation.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|rotate=Y"> |
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|degrees=90"> |
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|degrees=180"> |
How to change the font: You can change the font in the
counter graphic by adding a "pipe" character ("|")
followed by "dd=x" where the "x"
is some uppercase letter between "A" and "E."
In the five examples below, the HTML code is customized to achieve
the five different types of fonts that are available
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|dd=A"> |
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|dd=B"> |
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|dd=C"> |
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|dd=D"> |
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|dd=E"> |
How to change the color of
the numbers: You can adjust the color of the
numbers in the counter graphic by adding a "pipe" character
("|") followed by the string "prgb=xxxxxx"
where the letters "xxxxxx" are a six-character
hexadecimal code for the color you desire, or you can even use
the English word for the color, like "red." If you use
a hexadecimal code, do not precede it with a pound sign (#), like
you do in some other situations that call for a hexadecimal color
code. If you do not add the string, the default color is green.
In the example below, the font color is specified to be red.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|prgb=FF0000">
or
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|prgb=red"> |
How to force a fixed number
of digits: You can force a fixed number
of digits to be displayed in the counter graphic by adding a "pipe"
character ("|") followed by the string "md=n"
where the letter "n" is some non-zero integer
that represents the number of digits to be displayed. If you do
not add the string, the default number of digits will be five
or six. In the example below, the number of digits is specified
to be nine.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|md=9"> |
How to force no leading zeros: You can force no leading zeros
be displayed in the counter graphic by adding a "pipe"
character ("|") followed by the string "pad=0"
in the HTML code for the counter. If you do not add the string,
leading zeros will be displayed as necessary so that there are
at least five or six digits in the counter graphic. In the example
below, the HTML code specifies that no leading zeros be displayed.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|pad=0"> |
How to specify a literal string
of characters: You can specify a literal string
of characters to appear in the graphic instead of a counter. To
do so, add a "pipe" character ("|") followed
by the code "lit=string"
where the word "string"
represents the series of characters to be displayed. You can choose
one or more of the following characters: ap:-,1234567890. This
can more easily be explained with an example. (See below.)
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|lit=a1:30p-1,2,3,4,5,6,7,8,9,0"> |
How to display a clock instead
of a counter: You can display a clock in 12-hour
format instead of a counter by adding a "pipe" character
("|") followed by the string "display=clock"
in the HTML code for the counter. (See the example below.)
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|display=clock"> |
How to display a clock in
24-hour format ("military time"): You can display a clock in 24-hour
format instead of a counter by adding a "pipe" character
("|") followed by the string "display=clock|format=24"
in the HTML code for the counter. (See the example below.)
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|display=clock|format=24"> |
How to display a date instead
of a counter: You can display a date instead
of a counter by adding a "pipe" character ("|")
followed by the string "display=date" in the HTML code
for the counter. (See the example below.)
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|display=date"> |
An example of a counter that
combines more than one of the above attributes:
You can display a counter with
more than one of the attributes explained above simply by adding
all of the necessary codes separated by the "pipe" character
("|"). For instance, the example below shows a counter
that has both an optional font and is also rotated 90 degrees
counter-clockwise.
|
Counter: |
|
|
|
HTML Code: |
|
<IMG src="http://www.mhtc.net/cgi-bin/Count.cgi?df=username.dat|dd=C|rotate=Y"> |
For more information... You will have a lot more success
implementing the HTML code for the counter CGI script if you are
already familiar with HTML. There are many, very useful Web sites
that offer instructional information about HTML, as well as countless
books on the subject that are available at most fine book stores.
If you have specific questions about how to use MHTC's Counter
CGI script, please do not hesitate to telephone MHTC toll-free
at 1-800-843-5827. We would be happy to help you.
|
|
|