Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Angelo Geels  >  CountDown class  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example on how to use the class
Class: CountDown class
Display the time remaining to a give date
Author: By
Last change:
Date: 2010-05-05 08:25
Size: 1,222 bytes
 

Contents

Class file image Download
<?php
// First include the class file and make a new object
include("countdown.class.php");
$CountDown = new CountDown;

// The following piece of code will make a countdown until March 29th 2010 at 8 PM. (Local server time)
$out $CountDown->Give(20,0,0,5,29,2010);
echo 
"March 29th 2010, 20:00 - ".$out;

// The next code will set a different format for the countdown.
// You can use the following replacement strings:
//   {W}   This is the number of weeks
//   {Ws}  Either an 's' or nothing. Use as {W} week{Ws} in case it's 1 week, and not 1 weeks.
//   {D}   Number of days
//   {Ds}  Same as {Ws} but for days
//   {H}   Number of hours
//   {Hs}  Same as {Ws} but for hours
//   {M}   Number of minutes
//   {Ms}  Same as {Ws} but for minutes
$CountDown->format "Weeks: {W}<br />Days: {D}<br />Hours: {H}";
$out $CountDown->Give(20,0,0,5,29,2010);
echo 
$out;

// And the last setting is the use of the message that the countdown reached it's destination time.
$CountDown->finished "Happy new year!";
$CountDown->format "New year 2011!<br />Weeks left: {W}<br />Days left: {D}<br />Hours left: {H}<br />Minutes left: {M}";
$out $CountDown->Give(0,0,1,1,1,2011);
echo 
$out;
?>