Another upcoming events widget...
I am really waiting for someone to kickout an integrated calendar/events widget...
But until then, I am using this PHP widget for my events. I saw a few others on here, but they were not quite what I was looking for...
Feel free to use/hack/slash this code for your own use...
Navigate to AdminCP -> CMS -> Widgets.
Create a PHP Type Widget and paste the below code.
PHP Code:
ob_start();
global $db,$vbulletin;
$calendarid="1";
$per_page = "10";
//################################################
$d=date("d");
$m=date("m");
$y=date("y");
$sdate = mktime(0, 0, 0, date("$m"), date("$d"), date("$y"));
$edate = mktime(0, 0, 0, date("$m"), date("31"), date("$y"));
$and=" and dateline_from > '".$sdate."'";
$getevents=$db->query_read("SELECT eventid, title, dateline_from from " . TABLE_PREFIX . "event WHERE calendarid='".$calendarid."' $and order by dateline_from ASC LIMIT $per_page");
$count=0;
if(!$db->num_rows($getevents))
{
}
else
{
WHILE ($events=$db->fetch_array($getevents))
{
$dtitle=$events['title'];
$did=$events['eventid'];
$date = vbdate('m-d-y
',$events['dateline_from'], false,true,false,true);
if ($count = 2){$class="alt2";}else {$class="alt1";}
$year=date("Y");
$pagetitle = $f;
$pagetitle .= " ";
$pagetitle.=$year;
$eventbits .="<tr><td nowrap class=''><strong>".$date.":</strong></td><td width='100%' class=''><a href='calendar.php?do=getinfo&e=$did&c=".$calendarid."'>".$dtitle."</a></td></tr>";
$count++;
}
}
echo "<table align='center' width='100%'>";
echo $eventbits;
echo "</table>";
$db->free_result($getevents);
unset($events);
$output=ob_get_contents();
ob_end_clean();