Web Counter output displays
Because the output from the counter script is a file consisting of a number, we can
include it in a line of text in a document, or read it into a table. We can even change
the font size or include it in a hypertext link.
To insert the number of hits on the counter main page into the current document,
we do the following:
<!--#include file="countpage.hits"-->
because we've specified countpage.hits as the output file.
We can put this code snippet into tables, links, etc. Here are some examples:
The main counter page has been accessed
<!--#include file="countpage.hits"--> times.
The main counter page has been accessed
5302
times.
You are number <!--#include file="example.hits"--> to visit
this examples page.
You are number 651
to visit this examples page.
A whopping <FONT SIZE=+3><BLINK>
<A HREF="cheat.htm"><!--#include file="cheat.hits"-->
</A></BLINK></FONT> people have read the cheat page.
A whopping
people have read the cheat page.
Here's how to do a table:
The following code:
<TABLE BORDER=4 CELLPADDING=3 CELLSPACING=2>
<TR><TH>Page Accessed</TH><TH>Hits</TH></TR>
<TR>
<TD>Simple counter page</TD>
<TD><!--#include file="countpage.hits"--></TD>
</TR>
<TR>
<TD>Examples page</TD>
<TD><!--#include file="example.hits"--></TD>
</TR>
<TR>
<TD>Cheat page</TD>
<TD><!--#include file="cheat.hits"--></TD>
</TR>
<TR>
<TD>WestNet FAQ page</TD>
<TD><!--#include file="westfaq.hits"--></TD>
</TR>
</TABLE>
Gives the following result:
| Page Accessed | Hits |
| Simple counter page |
5302
|
| Examples page |
651
|
| Cheat page |
205
|
| WestNet FAQ page |
12667
|
If you are going to be checking your output count frequently, and especially
if the page displaying the output count isn't going to be frequently visited by
the public, you can do a little trick that makes the count update each time you
visit the page, by defeating the cacheing mechanism. Keep in mind that this
slows down access, so you don't want to do it on all of your pages.
Name the display page, as this one is, with a .sht or
.shtml extension. Don't make it executable with the chmod
command. The server will interpret it as "parsed HTML" and update
the page on each visit.
By not doing this, you may see a cached version from a previous
visit when you check your count, resulting in an outdated number.
Back to counter page