![]() |
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 |
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??
|
If you could that'd be great :)
|
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 |
Code:
ob_start(); 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. |
Thanks for this..............fantastic stuff
Works perfect and is exactly what i was after Have a huge bag of kudos :) |
Quote:
|
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? |
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. |
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. :) |
All times are GMT. The time now is 04:41 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|