Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post
Post Need Some Help With A Countdown Code. 
 
Hi all

i got a small problem with a countdown code i´m trying to implement in my F-1 WebTipp script.

to the time i got it all right with the vars assigned and all work´s, just this countdown give´s me an headache.

here´s the part of the code that throughs the error:

Code: [Download] [Hide] [Select]
//Countdown data
                if ($formel_config['show_countdown'] == 1)
                {
                    $event_stop    = date($races[$chosen_race]['race_time'] - $formel_config['deadline_offset']);
                    $b_day        = $userdata->user_dateformat($event_stop, 'd');
                    $b_month    = $userdata->user_dateformat($event_stop, 'n');
                    $b_year        = $userdata->user_dateformat($event_stop, 'Y');
                    $b_hour        = $userdata->user_dateformat($event_stop, 'H');
                    $b_minute    = $userdata->user_dateformat($event_stop, 'i');
                    $b_second    = $userdata->user_dateformat($event_stop, 's');
                    switch ($b_month)
                    {
                        case 1:
                                $b_month = 'January';
                        break;
                            
                        case 2:
                                $b_month = 'February';
                        break;
                            
                        case 3:
                                $b_month = 'March';
                        break;
                            
                        case 4:
                                $b_month = 'April';
                        break;
                            
                        case 5:
                                $b_month = 'May';
                        break;
                        
                        case 6:
                                $b_month = 'June';
                        break;
                            
                        case 7:
                                $b_month = 'July';
                        break;
                            
                        case 8:
                                $b_month = 'August';
                        break;
                            
                        case 9:
                                $b_month = 'September';
                        break;
                            
                        case 10:
                                $b_month = 'October';
                        break;
                            
                        case 11:
                                $b_month = 'November';
                        break;
                            
                        case 12:
                                $b_month = 'December';
                        break;
                    }

                    $stop = $b_month.' '.$b_day.', '.$b_year.' '.$b_hour.':'.$b_minute.':'.$b_second;
                    $countdown = "<script type=\"text/javascript\">
                                // <![CDATA[
                                var eventdate = new Date('".$stop."');
                                function toSt(n)
                                {
                                                            s=''
                                                            if(n<10) s+='0'
                                                            return s+n.toString();
                                }
                                function countdown()
                                {
                                    d=new Date();
                                    count=Math.floor((eventdate.getTime()-d.getTime())/1000);
                                    if(count<=0)
                                    {
                                        var time_event = document.getElementById('time_event');
                                        var event_time = document.getElementById('event_time');
                                        time_event.style.display = 'none';
                                        event_time.style.display = '';
                                        return;
                                    }
                                    secs_count = toSt(count%60);
                                    count=Math.floor(count/60);
                                    mins_count = toSt(count%60);
                                    count=Math.floor(count/60);
                                    hours_count = toSt(count%24);
                                    count=Math.floor(count/24);
                                    days_count = count;
                                    document.getElementById('countdown').days.value = days_count;
                                    document.getElementById('countdown').hours.value = hours_count;
                                    document.getElementById('countdown').mins.value = mins_count;
                                    document.getElementById('countdown').secs.value = secs_count;
                                    window.setTimeout('countdown()',500);
                                }
                                // ]]>
                                </script>";
                }



the error comes from here:


Code: [Download] [Hide] [Select]
$b_day        = $userdata->user_dateformat($event_stop, 'd');
                    $b_month    = $userdata->user_dateformat($event_stop, 'n');
                    $b_year        = $userdata->user_dateformat($event_stop, 'Y');
                    $b_hour        = $userdata->user_dateformat($event_stop, 'H');
                    $b_minute    = $userdata->user_dateformat($event_stop, 'i');
                    $b_second    = $userdata->user_dateformat($event_stop, 's');


It tells me :
Spoiler: [ Show ]


So my question is:

Would´nt it be better to get that data from server time instead of user_data ???

Or, how can y fix that error
 




____________
Out of Order
 
spydieSend private messageVisit poster's website  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron