Welcome to Islandnet.com  
Locally owned and operated since 1993  
Live Help
LOG IN:  Username:    Password:    

Counter

The counter gadget is an M-Script II program that can be used to count accesses to a page. It can optionally display the current counter value in a variety of textual or graphical formats. You can even supply your own graphical digits to totally customize the display.

You embed the counter in your web pages in one of two different ways depending on if you want graphical output or not. For hidden or textual output use this format:

<!--#exec cgi="/cgi-bin/ms2/LOGIN/counter?PARAMETERS" -->
When you want a graphical display use this format:

<img src="/cgi-bin/ms2/LOGIN/counter?PARAMETERS">
You would replace LOGIN with your own login name and PARAMETERS with a string of counter settings separated with an ampersand (&).

For example, a simple hidden counter for the login "mark" that increments a value stored in the file named "www/example.count" would be included like this:

<!--#exec cgi="/cgi-bin/ms2/mark/counter?f=www/example&s=invisible" -->
A textual display of the counter value could be done like this:

<!--#exec cgi="/cgi-bin/ms2/mark/counter?f=www/example" -->
A textual counter with "th", "st", "nd", and "rd" siffixes would be done with text2 like this:

<!--#exec cgi="/cgi-bin/ms2/mark/counter?f=www/example&i=1&s=text2" -->
And finally a graphical version could be done like this:

<img src="/cgi-bin/ms2/mark/counter?f=www/example&i=1&s=^strips/odometer.gif">

Parameters

f=filename
Specifies the name of a file, relative to your root directory, that will be used to store the counter value. The extension ".count" will be added to this automatically.

If you leave this option off, the program will try and figure out the filename based on what it knows. This only works if your page is accessed via a "www.islandnet.com/~username" style URL though.

i=n
Specifies the amount to increment the counter by. The default value is 1 so normally you don't need to use this at all.

w=n
Specifies the minimum width of the counter (in digits). If the number would be shorter than this it is left-padded with zeros. The default width is 0.

s=filename
Specifies the name of a GIF file, relative to your root directory, that contains a digit strip. To use one of the provided strips, make sure the filename starts with "^strips/", otherwise it will look for the file in your own account.

The default value is "text", which displays a text value. You can also set this to "text2", which is similar except that the number of followed by a suffix ("th", "st", "nd", or "rd"). Setting this value to "invisible" increments the counter but displays nothing at all.

l=n
Specifies the width, in pixels, of the left portion of the digit strip that is ornamental and NOT actually part of a digit. This portion will be added to the left side of the final output as well. The default value is 0.

r=n
Specifies the width, in pixels, of the right portion of the digit strip that is ornamental and NOT actually part of a digit. This portion will be added to the right side of the final output as well. The default value is 0.

t=n
Specifies which color index should be the transparent color. This number can range from 0 (the first color) up to 255. The default is to have no transparent color at all.

n=n
If the digit strip you are using has more than 10 characters in it (eg: it might contain a colon, an AM or PM symbol, etc) then set this number. The default value is 10.

Creating Digit Strips

If you want to use one of the sample digit strips above, all you have to do is use the same s parameter that is shown. The "^" at the start of the filename indicates that the file should be retrieved from a global area that all customers can access. Without a "^" the file is assumed to be in your own account. This allows you to provide your own digit strips to customize the look of the counter.

A digit strip is a GIF image (you cannot use a JPG or any other image format as a digit strip). At a minimum it must consist of the ten digits 0 through 9 (in that order). Each digit must have the exact same height and width, and the overall image width must be perfectly divisible by 10 (or whatever value you specified with the N parameter).

You may optionally add an ornamental border to the left and right sides of the image strip. If you do then you must also make use of the l and r parameters. The portion of the strip in the middle must be evenly divisible by 10 (or whatever value you specified with the N parameter).

For example, here is the "odometer.gif" image strip, which has no ornamental borders:

And here is "big_red.gif", which has ornamental borders:

Click here to view all of available digit strips



Page generation time: 0.02 seconds