Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 10:19 am EDT

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
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;
}
 
enjoy....
We never stop looking... ...for a better way
 Quote

Status: offline

Fraggle

Forum User
Newbie
Registered: 11/03/02
Posts: 10
would be even better if it could include the hours, minutes, and seconds HEHE Smile---the c0w says: m00
the c0w says: m00
 Quote

Status: offline

alinford

Forum User
Regular Poster
Registered: 01/06/03
Posts: 96
Great block. I run a family site that has several family wide events every year. This will work perfectly for me.
 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; }
 Quote

Status: offline

alinford

Forum User
Regular Poster
Registered: 01/06/03
Posts: 96
It also turns off the block day after the event.
 Quote

Status: offline

watcorp

Forum User
Junior
Registered: 09/03/02
Posts: 23
nice mod ...thank you ---We never stop looking... ...for a better way
We never stop looking... ...for a better way
 Quote

Status: offline

alinford

Forum User
Regular Poster
Registered: 01/06/03
Posts: 96
I am a PHP moron and do not know any PHP at all. I just looked at some of the other plugins and played around until I got it to work right. Smile If anybody has improvements or changes, feel free.
 Quote

All times are EDT. The time is now 10:19 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