Basically it is code which checks a calendar for events, and outputs the following event complete with a countdown timer. The problem is that it seems to overlook an event if it is the following day, for example even though there is an event on the calendar on tomorrow's date, it thinks the next event is the one after that (next weekend).
ob_start();
global $db,$vbulletin;
$event_calendarid="2";
$no_events_message="<div style='width: 100%; text-align: center; font-weight: bold'>TBA</div>";
$today_date = mktime(0, 0, 0, date(date("m")), date((date("d"))), date(date("y")));
$and=" and dateline_from > '".$today_date."'";
$getevents=$db->query_read("SELECT eventid, title, dateline_from from " . TABLE_PREFIX . "event WHERE calendarid='".$event_calendarid."' $and order by dateline_from ASC LIMIT 2");
$count=1;
if(!$db->num_rows($getevents))
{
echo $no_events_message;
}
else
{
echo "<script type='text/javascript'>\n";
WHILE ($events=$db->fetch_array($getevents))
{
$event_title=$events['title'];
$event_date = vbdate('U',$events['dateline_from'], false,true,false,true)-vbdate('U');
if($count==1)
{
echo "var CountDownTimer=new CountDown('CountDownToChange',1,'".$event_title."<br />','".$event_date."','ywdhms',1)\n";
}
else
{
echo "CountDownTimer.AddNewEvent('".$event_title."<br />','".$event_date."','ywdhms',".$count.")\n";
}
$count++;
}
}
echo "CountDownTimer.DisplayTime(FormatResults)\n";
echo "</script>\n";
$db->free_result($getevents);
unset($events);
$output=ob_get_contents();
ob_end_clean();
How could I change this so it recognises not only tomorrow's events, but also today's i.e. if there is an events scheduled for today's date, it will display that.
Thanks

New Topic/Question
Reply



MultiQuote






|