PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Russell Nash  >  Page Counter  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example script
Class: Page Counter
Display a graphical page hit counter
Author: By
Last change: examples of new features explained.
Date: 10 years ago
Size: 1,855 bytes


Class file image Download
include './hit-counter.php';
$Counter = new PageCounter();
$Counter->SetMinLen('5'); // eg 00123
$Counter->SetImgSize('25','25'); // height and width of the digit image
// this is used to hold the generated html without the new features set.
$noBorder = $Counter;
// set border use and color.
// the triger page allows the hit counter to be placed on any page but only increment on a single page.
// the triger also checks the query string, i.e. ?page=1&this=that
// remember that if the triger page has no ?page=1&this=that to include the ? at the end
<table cellpadding="0" cellspacing="0"><tr>
<td align="left" colspan="2"><br style="font-size:4pt">
My Counter<br>
 <?= date("l F j Y") ?><br><br style="font-size:4pt"></td></tr>
<tr><td height="20">&nbsp;</td></tr>
This has a border set and a triger page<br>
To see this counter increment, change the triger page address to the one you are viewing this example from.<br><br style="font-size:4pt">
Site Visitors<br><br style="font-size:4pt">
simply use the following line anywhere in a page to display the Hit Counter.
<?= $Counter->HitCount(); ?>
<tr><td height="20">&nbsp;</td></tr>
This has no border and no triger page<br>
This only has the properties set that was available in the previous version.<br><br style="font-size:4pt">
Site Visitors<br><br style="font-size:4pt">
<?= $noBorder->HitCount(); ?>