The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Upcoming Events Details »» | |||||||||||||||||||||||||||
Upcoming Events
Released 28/12/2009 By Vikas - http://www.ngcoders.com Installation
PHP Code PHP Code:
Screenshots
Show Your Support
|
2 благодарности(ей) от: | ||
level8, Toorak Times |
Comments |
#222
|
|||
|
|||
What I'm after is the upcoming events to be displayed.
And (if ranged) the start and end times In english No historical events to be displayed Sorry to be a pain in the ass |
#223
|
|||
|
|||
ok the code in my earlier post does that. how ever it only displays the date are you say you want the time displayed also??
|
#224
|
|||
|
|||
If you could that'd be great
|
#225
|
|||
|
|||
This is the code i'm currently using.......
Quote:
This does everything but the time..............and it seems to remove a planned event for the day as soon as the clock turns midnight (i.e. if there is a meet planned for the 17th May then as the clocks turn from 23:59 (tues) - 00:00 (weds) the event is removed |
#226
|
|||
|
|||
Code:
ob_start(); global $db,$vbulletin; $mydate3 = mktime(0, 0, 0, date("m"), date("d"), date("Y")); // %d $show_count =10; $query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '$mydate3' || ( dateline_from >= '$mydate3' 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",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true)); } else { $format = sprintf("From %s to %s",vbdate('D M jS Y h:i:s A',$event['dateline_from'],false,true,false,true),vbdate('jS M Y h:i:s A',$event['dateline_to'],false,true,false,true)); } $output_bits .= sprintf(' <div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4> <p class="cms_widget_post_content">%s</p> </div> ',$event['eventid'],$event['title'],$format); } $output = $output_bits; this will display the times for the Range events. But there is a small catch when you enter the range event leave the time zone setting to GMT. i left off the time for the all day event as its always the same time because of the way its stored. i also fixed a bug in my code the mydate3 variable was commented out for my fixed date. |
#227
|
|||
|
|||
Thanks for this..............fantastic stuff
Works perfect and is exactly what i was after Have a huge bag of kudos |
#228
|
|||
|
|||
Quote:
|
#229
|
|||
|
|||
Quote:
2) The code is working fine but it shows all events in the widget not the 10 as the cutoff is set for. Can that be fixed? |
#230
|
|||
|
|||
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); $event_get = vB::$db->query_read($query); $output_bits = ''; while($event = vB::$db->fetch_array($event_get)) { $tz_offset = 86400; if($event['dateline_to'] == 0 ) { $format = sprintf("On %s",date('M jS Y',($event['dateline_from']+$tz_offset))); } else { $format = sprintf("From %s to %s",date('h:i A M jS Y',($event['dateline_from'])),date('h:i A M jS Y',($event['dateline_to']))); } $output_bits .= sprintf(' <div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4> <p class="cms_widget_post_content">%s</p> </div> ',$event['eventid'],$event['title'],$format); } $output = $output_bits; ob_end_clean(); 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 am still debating on dropping the Year form the widget since 99% of the time the next 5 events are in the same year anyway. To do that simply drop the Y from the M jS Y or h:i A M jS Y See it live, 3rd block from the top on the right column. http://xboxhounds.com I'm simply an amateur but I'm learning with as I go. |
#231
|
|||
|
|||
You can customize the date however you want, see the php documentation:
http://www.php.net/manual/en/function.date.php The time offset should be in the database-query, not in your output date. As for showing Users their local time. I thought about changeing the widget that way, but then i think i can't use the cms-widget-cache anymore on this particular widget. I just can't imagine the widget beeing created for multiple timezones in the cache. Second issue with local time is the utc-column in the event-db-table. You need to correct for that value as well, depending on which timezone the user chose upon adding the event. --------------------------------- Thanks to the creator of the widget. Great work, great idea. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|