My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
StatsClass  

Stats PHP:Class

Added in version 2.4.2

This class will provide you with stats for your guestbook in real time. The stats are based on the posts make on the guestbook by any user including the admin.

Day Stats

Return Numbers

Using the methods in the class are very easy, below is an example of how to include the class and then make a call to a method.

include 'data/functions.php'
$stats = new Stats();
// Get the number of posts from today.
$stats->day(0);
// Will return a number.

//Get yesterdays numbers
$stats->day(1);
// Will return a number

Return dates

Now that we have the numbers of posts we would like to display the dates they belong to. To do so just use the following example.

include 'data/functions.php'
$stats = new Stats();
// Get Todays date
$stats->daydate(0);
// Will return the date (Format: mm/dd)
// You may also display the year by calling the method with true
$stats->daydate(0,true); // This will return todays date in this format (MM/DD/YY)

//Get yesterdays date
$stats->daydate(1);
// Will return the date (Format: mm/dd)

Get the largest number

This method is used to return the biggest number of posts for a set number of days starting from today.

include 'data/functions.php'
$stats = new Stats();
$stats->highnumber('day',6);

The first parameter in this call id the name of the method we are calling, in this case it's 'day'. The second is the number of days you would like to look back, remember that '0' is today so the number '6' would return 7 numbers to sort.


Month Stats

Return Numbers

Using the methods in the class are very easy, below is an example of how to include the class and then make a call to a method.

include 'data/functions.php'
$stats = new Stats();
// Get the number of posts from today.
$stats->month(0);
// Will return a number.

//Get last month numbers
$stats-> month(1);
// Will return a number

Return dates

Now that we have the numbers of posts we would like to display the dates they belong to. To do so just use the following example.

include 'data/functions.php'
$stats = new Stats();
// Get Todays date
$stats->monthdate(0);
// Will return the date (Format: mm/yy)

//Get last months date
$stats->monthdate(1);
// Will return the date (Format: mm/yy)

Get the largest number

This method is used to return the biggest number of posts for a set number of months starting from today.

include 'data/functions.php'
$stats = new Stats();
$stats->highnumber('month',6);

The first parameter in this call id the name of the method we are calling, in this case it's 'month'. The second is the number of months you would like to look back, remember that '0' is today so the number '6' would return 7 months to sort.


Sign in to add a comment
Powered by Google Project Hosting