Add a Counter
FrontPage users follow the instructions for a
FrontPage-specific
counter.
A counter may be added to your page to record
and display the number of people who have viewed your home
page.A typical counter display:
You are visitor number:
Before creating the counter, ITD recommends
that you understand the following:
To create this counter, you will do the
following:
- Create the counter directory within public_html
- Create a file to store the number of visits to your page
- Create a configuration file that sets all of the options for
the counter
- Change the permissions of these files and the directory so
that they can be read from the web
- Insert the appropriate IMG tag in your HTML document
Instructions
Create the Counter Directory within
"public_html"
- At the frank prompt, change to your "public_html" directory.
frank $ cd public_html
- Create a directory for the counter, naming it "counter."
frank $ mkdir counter
- Change the group for "counter" to that of the web server.
frank $ chgrp httpd counter
- Change the permissions for "counter" to make the directory
accessible on the web.
frank $ chmod 775 counter
- Open "counter."
frank $ cd counter
Create a File to Store the Number of Visits to
Your Page
- Use
Pico (a text editor on
frank) to create a file that will store the number of visits to
your page.
Name the file "home.count."
frank $ pico home.count
- Type the number you want the counter to start at (e.g. 1 or
10).
- Exit Pico, answering
Yes to save the file.
Ctrl-X (exit)
Y (Yes to save)
- Change the group for "home.count" to that of the web server.
frank $ chgrp httpd home.count
- Change the permissions for "home.count" to make it accessible
on the web
frank $ chmod 775 home.count
Create a Configuration File that Sets All the
Options for the Counter
- Use Pico to create the configuration file that will set all
your options for the counter.
frank $ pico home.config
- Type in the desired options and required directory path
names. (Read Configuration
optionsand
samples.)
- The following line is required in "home.config":
CountFile=/
path to your home directory
/public_html/counter/home.count
frank $ pwd will tell you where you are currently
working; the "path to your home directory"
is from the first slash to your username:
/users/your group/username/...
- Exit Pico, answering
Yes to save the file.
Ctrl-X
Y
- Change the permissions for home.config.
frank $ chmod a+r home.config
Add the Text and HTML Tags to Your Web
Document
- Add the following text and tags to your html document:
You are visitor number:
<img src="/cgi-bin/counter.pl?
path to your home directory
/counter/home.config">