[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
[an error occurred while processing this directive]

Web Page Counter


NOTE: This counter can only be referenced from faculty, staff, and department home pages. A local counter for student home pages can be found at http://www.students.mines.edu/examples/count/.
This page has been accessed times.

We have set up a local WWW homepage counter which depends on Server Side Includes (SSI). To setup this counter for your page you must follow several steps:

  1. Give the file that is to be counted a ".shtml" extension. Our local web server will only evaluate SSI commands if they are included in a file with .shtml extension. Evaluating SSI files takes slightly longer than a regular file, so it does slow the response to the client.

  2. Create a file to hold number of times file web page has been hit. This is a different file than the HTML page. This file can initially be empty, but it must exist, and it must have world read permissions (you may have to load the page twice before the counter is displayed).

  3. Anywhere within the BODY of your HTML document, use the following SSI command:

    <!--#exec cmd="/csminfo/htdocs/CSM_home/cgi-bin/count </FULL_PATH/COUNTER_FILENAME> ND" -->

    This line must be entered completely on one line, otherwise it will not work.

    There are no spaces in the "<!--#exec" portion of the command".

    The full pathname for the counter file must be specified (this is not the web address of the counter file).

    The ND parameter is optional. It means "No Display." If the ND parameter is used, the count is not displayed on the page, but the count file is incremented. If the ND parameter is not used, the counter will be displayed on the page, and the count file is incremented. If the counter is displayed, the counter will appear within the display at the location of the SSI command.

The counter has been used on this page, above. The SSI exec command was placed between "This page has been accessed" and "times." The exact command used was:
<!--#exec cmd="/csminfo/htdocs/CSM_home/cgi-bin/count /csminfo/htdocs/CSM_home/help/html/count.cnt" -->
(The "exec" command line must all be on a single physical line in your .shtml document; browsers often wrap this text)!

Another example

[an error occurred while processing this directive]


Questions and comments -- open a ticket at Mines Help Center
Thursday, 13-Sep-2007 09:43:00 MDT