Countdown Script

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Countdown Script
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
heres a Countdown Script that i made in my spare time icon_smile.gif Hope ya like it icon_mrgreen.gif
[ Register or login to view links on this board. ]

(its in action at in the top of my header, the christmas and new year countdown)

Gareth




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   re: Countdown Script
Tuffy
CZ Addict
 Codezwiz Site Donator
Tuffy has been a member for over 20 year's 20 Year Member
usa.gif newyork.gif
Occupation: Wedding Photographer
Age: 58
Gender: Female
Fav. Sports Team: NY Mets
Website:
Status: Offline
Joined: Nov 20, 2003
0.10 posts per day
Posts: 724
Points: 127,871
AIM Address Yahoo Messenger  
icon_biggrin.gif Nice job but isn't it a day or two off? icon_eek.gif

Is it dependent on the date you put in?




_________________
Back to top Reply with quote
#3   re: Countdown Script
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
It does it like this:

lets say its 11:50pm of the 2nd january, and you put in to countdown to the 3rd, it would come up 0 days, or if you put it at 12.01am on the 3rd it would still say 0 days, 1 second or minute into the day and it's well, still ACURATE, jus says no days because it doesn't display the time, but anyway, its good enough for me icon_mrgreen.gif
lol

Gareth




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#4   re: Countdown Script
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Well if it makes you feel better you could replace

$return = "" . (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400) . " days until $event";


With

$return = "" . (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400+1) . " days until $event";


Which adds 1 day to make it looks more acurate, look at my site now i done it on mine ( [ Register or login to view links on this board. ] )

Gareth



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#5   re: Countdown Script
XX_YAHOO_XX
CZ Super Newbie
XX_YAHOO_XX has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Occupation: Build Cusotm Golf Cars
Gender: Male
Fav. Sports Team: RCR RACING
Website:
Status: Offline
Joined: Feb 01, 2004
0.01 posts per day
Posts: 66
Points: 3,735
 Yahoo Messenger  
Countdown Script
In this tutorial you will learn how to make a countdown script, its pretty easy....

Put this code at the top of your php file, in a header of something, or in a functions file ( e.g. functions.php ).

function countdown($event, $day, $month, $year) { $return = "" . (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400) . " days until $event"; return $return; }


If you placed it in another file not connected to your main files, include it in the header:

include("thefile.php");
Now lets get onto using it:

Place this code into your file ( e.g. index.php )

ob_start(); echo countdown("The Event", "day", "month ( 1-12 )", "year"); $output = ob_get_contents(); ob_end_clean(); echo "$output";


If you wanted to make it say something on the day put this just before the echo "$output"; :

if($output < 1) { $output = "The message"; }



Back to top Reply with quote
#6   re: Countdown Script
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 19 year's 19 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
May I ask why you done that?




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum