Version: 1.01, by JohnKF
Developer Last Online: Oct 2013
Category: vBulletin CMS Widgets -
Version: 4.0.6
Rating:
Released: 10-14-2010
Last Update: Never
Installs: 57
Template Edits
Re-useable Code Additional Files Translations
No support by the author.
This widget picks up the next 2 events from a calendar of your choice.
It displays a countdown to the first event then once the first event has arrived it begins a countdown to the second event. The only reason for picking up two events is that someone may visit the page close to the end of the first event then see the no event message. By picking up two events such a visitor will see the countdown to the second event start.
To install...
From the ZIP file, extract eventcountdown.js and copy it to your site.
Navigate to AdminCP -> Style & Templates -> Style Manager -> Edit Template
Double click the headinclude template to edit it and add the following just above the first <script tag you find...
...the above assumes you have copied eventcountdown.js file in to a folder called scripts. Adjust the src path to wherever you have placed the .js file.
Navigate to AdminCP -> CMS -> Widgets.
Create a PHP Type Widget and paste the below code.
PHP Code:
ob_start();
global $db,$vbulletin;
$event_calendarid="1";
$no_events_message="<div style='width: 100%; text-align: center; font-weight: bold'>There are no events.</div>";
$today_date = mktime(0, 0, 0, date(date("m")), date(date("d")), date(date("y")));
$and=" and dateline_from > '".$today_date."'";
Navigate to AdminCP -> Forums & Moderators -> Forum Blocks Manager
Click the Add Block button
From the drop down list select Custom HTML/PHP
Click the Continue button
Give the block a title (e.g. Event Countdown) and a short description
Set the cache time to 1 minute
In Content Type select PHP
In Content paste the PHP code above in to the text box
Click the Save button
You can set the value for $event_calendarid to the calendar that you want countdown events to come from. Change $no_events_message to the HTML you want to have appear when there are no events left in the selected calendar.
This is the first widget I've written so if you spot any errors or improvements that can be made then please let me know.
If you have an all day event in the calendar the countdown is to the begining of that day. Add a ranged event to the calendar for an exact time. Also, allow for any changes that may occur if a change to or from DST occurs.
Added ob_start(); to beginning of script (17th Oct, 2010)
To have a picture make the Title of the event in the calendar the HTML to display the picture. For example...
HTML Code:
Your Event<br /><img src="images/picture.gif" width="140" height="130" alt="">
...which shows as the text above in the calendar title, but displays as text and a picture in the countdown.
It works for me in 4.2.2 pl4. Setup the HTML "on" in the calendar option to help out
Is there a way to translate the "weeks, days, hours" in french ??
Stuck on this one and as for the image with the heading, i can't get this to work
This also is working on vBulletin 4.2.5. I would love to be able to display a countdown list of events as my site has more than one event on any given day.
However the only issue I have left to figure out is the time offset is wrong. I have my board and everything I can find set to CST -6 but the countdown is 6 hours off.
The work around I found is to set the time zone to GMT -0 in the calendar event, then the time is synced correctly.