killerford
08-31-2012, 02:52 PM
Does anyone know how to get the calender on the sidebar?
--------------- Added 1346454137 at 1346454137 ---------------
And is it possible to get calender events on the sidebar if you can't get the whole calender on? Just the events pop up saying like upcoming events?
qpurser
09-10-2012, 07:39 AM
I have been using a sideblock to show upcoming events in vB 4.2.x
I completely forgot where I got the code from but it works.
Create a new php/html sideblock
Title: whatever you want to name it
Content Type: PHP
Content: add this code:
ob_start();
// %d
$show_count = 5;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
$event_get = vB::$db->query_read($query);
$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}
$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h6 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s<br><img src="images/UpcomingEventDivider.gif"></p>
</div>
',$event['eventid'],$event['title'],$format);
}
$output = $output_bits;
ob_end_clean();
return $output;
In the code there is a reference to "<img src="images/UpcomingEventDivider.gif">"
It is a simple line to divide the events. I added this for you as an attachment but you can use any other line image of course.
That's it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.