Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 08:25 am EST
Geeklog Forums
Countdown Block
Status: offline
watcorp
Forum User
Junior
Registered: 09/03/02
Posts: 23
here is the modification of the countdown script by the folks at Open Concept Computing
modified slightly for use as a geeklog block
function phpblock_countdown(){
// Change the Dates to meet your needs
$day = 6; // Day of the countdown
$month = 12; // Month of the countdown
$year = 2003; // Year of the countdown
$retval = ('There are ' . (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400)
. ' days left til your event');
return $retval;
}
enjoy....
We never stop looking... ...for a better way
modified slightly for use as a geeklog block
Text Formatted Code
function phpblock_countdown(){
// Change the Dates to meet your needs
$day = 6; // Day of the countdown
$month = 12; // Month of the countdown
$year = 2003; // Year of the countdown
$retval = ('There are ' . (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400)
. ' days left til your event');
return $retval;
}
We never stop looking... ...for a better way
12
10
Quote
Status: offline
alinford
Forum User
Regular Poster
Registered: 01/06/03
Posts: 96
I modified a few things in the Countdown block:
Fixed an error that had it running 1 day off.
Fixed the grammar issue when there is 1 day left.
Added a greeting for the day of the event
function phpblock_countdown(){
// Change the Dates and Event Name to meet your needs
$day = 6; // Day of the countdown
$month = 3; // Month of the countdown
$year = 2003; // Year of the countdown
$event = 'Your Event'; // Event Name
$days_left = (int)(1+(mktime (0,0,0,$month,$day,$year) - time(void))/86400);
if ($days_left > 1) {
$retval = ('There are ' .$days_left .' days left til ' .$event .'!');
}
if ($days_left == 1) {
$retval = ($event .' Starts Tomorrow!');
}
if ($days_left == 0) {
$retval = ($event .' Starts Today!');
}
return $retval;
}
12
13
Quote
All times are EST. The time is now 08:25 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content