Back to Applications

What Is Counter


The counter is an easy-to-use counter with the flexibility to make both text and images look how you want them to. It keeps track of the number of 'hits' to your web pages.

Installing Counter

For installation instructions, please click here.

Using Counter

The page counter is an easy-to-use counter with the flexibility to make it look how you want, both in text and image formats. There are three files, plus numeral images, that make up the page counter, they are:

  • /home/[account]/www/cgi-bin/counter/counter.cgi
  • /home/[account]/www/CGI-bin/counter/config.txt
  • /home/[account]/www/CGI-bin/counter/stats.dat
  • /home/[account]/www/plugins/counter_images/*.gif

Once you have installed the counter through your site manager, you can immediately begin using the counter by placing the appropriate HTML on the page you want a counter. Below are two samples and their corresponding HTML code.

Image Counter

Appearance: 

Code: <script language="JavaScript" type="text/javascript" src="/cgi-bin/counter/counter.cgi?display=image&page=index.html&style=odometer"> </script>

Text Counter

Appearance: 3736

Code: <script language="JavaScript" type="text/javascript" src="/cgi-bin/counter/counter.cgi?display=text&page=index.html&style=bigblue"> </script>

The numbers displayed above are different because the counter loads, updates the stats.dat file, and then loads again. Normally you will not have the counter displayed twice on a single page so this is not a problem.

Placing Links on a Page

There are three variables you need to define when you place the link on a page:

  • display: Choose if you want your counter displayed as "image" or "text" on the page.
  • page: The page name. If you put the counter on index.html, place index.html as the value. This is not a required field, but if someone views the page from behind a firewall, they may not pass all the information required to the counter script and the visitor's hits won't show up properly.
  • style: Choose a style defined in the config.txt file. Each style will have a name surrounded by brackets like this: [odometer]. Choose a style appropriate to what you chose for the display option.

Once you have gotten your first hit on your page, you can edit the "stats.dat" file and change the number of digits shown. It will count up from 1 by default, displaying the 1 character first, then 2 as it passes 10, 3 as it passes 100, and so on. By editing the stats.dat, you can pad your stats by increasing the number shown to what you wish, as well as adding 0s (zero) to the beginning to change how many digits are shown.

Changing Styles

If you don't like the default styles available to you, you can add as many as you want to the config.txt file. Having multiple styles available also means that you can display your counter differently on different pages.

To add a new image style, edit the config.txt file and enter two lines:

  • Style Name: A style name will be surrounded by brackets like this: [my_style]. Don't use quotes, ampersands, or characters other than letters, numbers, dashes, and underscores, otherwise you could break your counter and it won't display properly.
  • Image File Name: The base image name to load when using this style. When you specify a file name, you do not include any number, the script will append the number at the end. For example, if you have images named odometer0.gif through odometer9.gif, you would enter odometer.gif as the file name. Don't forget to upload your images to your /home/[account]/www/plugins/counter_images/ folder.

Sample Image Style:


[odometer]
odometer.gif

To add a new text style, edit the config.txt file and enter two lines:

  • Style Name: A style name will be surrounded by brackets like this: [my_style]. Don't use quotes, ampersands, or characters other than letters, numbers, dashes, and underscores, otherwise you could break your counter and it won't display properly.
  • Text Style: The HTML code to make the text display how you would like it. You can use FONT tags, Bold, Italic, or CSS (style sheets) to do this, but it must all be on a single line. Somewhere in the line must be the text "COUNTER" in all upper case. This is where the script will place the number to be displayed.

Sample Text Style:

3736
[bigblue]
<span style="color:#0C2D82;font:15px Verdana, Geneva, Arial, Helvetica, sans-serif;">COUNTER</span>



Related Articles

How To Activate SSL In OSCommerce
How To Reset My OSCommerce Password
What Is OSCommerce
How To Reset My Drupal Password
What Is Drupal

Can’t Find what you need?

No worries, Our experts are here to help.