Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Countdown to Calendar Event Details »
Countdown to Calendar Event
Mod Version: 1.01, by JohnKF (Member) JohnKF is offline
Developer Last Online: Oct 2013 I like it Show Printable Version Email this Page

vB Version: 4.0.6 Rating: (5 votes - 4.20 average) Installs: 57
Released: 15 Oct 2010 Last Update: Never Downloads: 343
Not Supported Template Edits Additional Files Re-usable Code Translations  

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...

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

...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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

To create a forum block...
  1. Navigate to AdminCP -> Forums & Moderators -> Forum Blocks Manager
  2. Click the Add Block button
  3. From the drop down list select Custom HTML/PHP
  4. Click the Continue button
  5. Give the block a title (e.g. Event Countdown) and a short description
  6. Set the cache time to 1 minute
  7. In Content Type select PHP
  8. In Content paste the PHP code above in to the text box
  9. 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...

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

...which shows as the text above in the calendar title, but displays as text and a picture in the countdown.

Download Now

Only licensed members can download files, Click Here for more information.

Screenshots

Click image for larger version

Name:	eventcountdown.jpg
Views:	2484
Size:	8.2 KB
ID:	122828  

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
[RELEASE vB 2.0.3] Countdown To Calendar Events mister vBulletin 2.x Full Releases 18 07 Oct 2001 23:29

Comments
  #2  
Old 15 Oct 2010, 21:24
betts02's Avatar
betts02 betts02 is offline
 
Join Date: Jun 2009
REQUESTS :

Allow upto 5 events
Forum Block

Cheers
Reply With Quote
  #3  
Old 15 Oct 2010, 21:30
JohnKF JohnKF is offline
 
Join Date: Oct 2010
Extra Events

I'll do that but in the meantime just change the number 2 at the end of this line...

("SELECT eventid, title, dateline_from from " . TABLE_PREFIX . "event WHERE calendarid='".$event_calendarid."' $and order by dateline_from ASC LIMIT 2");

...to the number of events you want picking up.

The JavaScript can handle many events.

What's Forum Block? I only started using vBulletin a week or so ago and I'm not completely familiar with it yet.
Reply With Quote
  #4  
Old 15 Oct 2010, 22:39
betts02's Avatar
betts02 betts02 is offline
 
Join Date: Jun 2009
Forum block is the side bar if you wish

Check my site in the link below to see the side blocks i have
Reply With Quote
  #5  
Old 15 Oct 2010, 22:48
paarmis.queen paarmis.queen is offline
 
Join Date: Oct 2010
tnx installed
Reply With Quote
  #6  
Old 16 Oct 2010, 07:28
JohnKF JohnKF is offline
 
Join Date: Oct 2010
Thank betts02. I assume then that you wanted multiple countdowns to be displayed. The script only shows a single countdown to the next event. Once that has been reached it starts the countdown to the second event. If the visitor arrives at a page with the countdown running a few seconds before zero then once zero arrives the second countdown will start. This is the reason for picking up 2 events. I'll look at allowing for multiple countdows to be show, say the first one from each calendar.
Reply With Quote
  #7  
Old 16 Oct 2010, 07:50
ProFifaLeagues's Avatar
ProFifaLeagues ProFifaLeagues is offline
 
Join Date: Aug 2009
Real name: Rob
Be great in the forum block if you can do mate
Reply With Quote
  #8  
Old 16 Oct 2010, 07:50
betts02's Avatar
betts02 betts02 is offline
 
Join Date: Jun 2009
What i wanted if possible is for this in a forum block

Shows events 1-5

Event 1 shall be on countdown
Event 2-5 shall be shown

As soon as event 1 has been and gone, It removes the event and places event 2 on countdown

Then event 6 shall become event 5 and be shown
Reply With Quote
  #9  
Old 16 Oct 2010, 08:02
JohnKF JohnKF is offline
 
Join Date: Oct 2010
Noted. Suggest you have a quick try of it as it stands so that you can see how an event countdown is show regarding width for an event that's a few weeks off.

Also I forgot to mention another slight change you can make...
In the widget PHP code find 'ywdhms' which appears twice. This sets which units appear in the countdown. The default is to show a countdown in Years, Weeks, Days, Hours, Minutes and Seconds.

You can pick which units are shown, so for a seconds only countdown you should just need 's' and for Days, and Minutes it would be 'dm'.
Reply With Quote
  #10  
Old 16 Oct 2010, 08:29
betts02's Avatar
betts02 betts02 is offline
 
Join Date: Jun 2009
Tried it in a forumblock and it just messes all my forums up
Reply With Quote
  #11  
Old 16 Oct 2010, 10:57
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Real name: Sadiq
Thanks ..
Reply With Quote
  #12  
Old 16 Oct 2010, 20:58
betts02's Avatar
betts02 betts02 is offline
 
Join Date: Jun 2009
Hey buddy,

You're missing an ob_start at the front of this script. Recommend you add it in, otherwise the block will break the script that started before it as well as itself.
Reply With Quote
  #13  
Old 16 Oct 2010, 21:50
ahmedipa ahmedipa is offline
 
Join Date: Feb 2009
nice one thank you very much
Reply With Quote
  #14  
Old 17 Oct 2010, 02:12
trophyrider trophyrider is offline
 
Join Date: Apr 2009
The script works fine in the forum block area if you add:

ob_start();

at the beginning of the php script.
Reply With Quote
  #15  
Old 17 Oct 2010, 02:13
trophyrider trophyrider is offline
 
Join Date: Apr 2009
Originally Posted by trophyrider View Post
The script works fine in the forum block area if you add:

ob_start();

at the beginning of the php script.
See example at http://www.sporttouring.us
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 16:47.

Layout Options | Width: Wide Color: