Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Upcoming Events. Keep it short as this is what will appear as title on your pages.
Click Save
Click Configure on the right of the new created widget.
Remove the default code that appears. Be sure to not leave behind even a single letter.
Copy and Paste the code that you can find below.
Leave the template name as is (vbcms_widget_execphp_page)
Click Save
Goto Admincp->vBullietin CMS->Layout Manager
Click Go on the Default Layout
Add the Widget to your Layout
Click Save
That's all !!
PHP Code
PHP 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);
Okay this works for me and should fix anyone's problem whether it is ranged events or single day events or the 1 day early problem.
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);
It is set to cut off at 5 events, you can adjust that via $show_count = 5.
It has a timezone offset of 1 day via seconds for the 1 day early issue here $tz_offset = 86400
Its format for date is set to Time, Date, Month, and Year via here $format = sprintf("From %s to %s",date('h:i A M jS Y',($event['dateline_from']+$tz_offset)),date('h:i A M jS Y',($event['dateline_to'])));.
And here for the all day events that do not include time of day ; $format = sprintf("On %s",date('M jS Y',($event['dateline_from']+$tz_offset)));
} else {
I used the above code but the current date & it's events are not showing; just the next day's date & it's events. Any ideas?
Thanks muchly. Don't know how I missed that post, I *thought* I'd read all 16 pages
Would you happen to know of a way to either put the 'from/to' *above* the 'event'? Or maybe a horizontal bar/separator between each event in the list? I've been playing with it but no luck.
Ugh. Hate to bug ya but.... everything is working/showing properly *except* the 'to' date... it's showing 1 day extra.
i.e. date range is 12:01 AM July 1 2011 to 11:59 PM July 7 2011
yet in widget it's showing as
Ugh. Hate to bug ya but.... everything is working/showing properly *except* the 'to' date... it's showing 1 day extra.
i.e. date range is 12:01 AM July 1 2011 to 11:59 PM July 7 2011
yet in widget it's showing as
thanks for the bug report i'll get it resolved shortly.
i also added to my version the ability to have and image that is in the event to be displayed with each item.
i also added the capability to add a divideing line between events i just need a horizontal line image of the right size.
Another question....
If an event say lasts a week and the 'current' date/time is during that week (but after the 'start' date/time) the event isn't showing even though the event isn't 'completed'.
Another question....
If an event say lasts a week and the 'current' date/time is during that week (but after the 'start' date/time) the event isn't showing even though the event isn't 'completed'.