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:	2496
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 08 Oct 2001 00:29

  #31  
Old 26 Oct 2010, 11:01
cindy helmond's Avatar
cindy helmond cindy helmond is offline
 
Join Date: Feb 2006
Real name: cindy
Originally Posted by starman™ View Post
Is the URL in the script code for the js file pointing to the right place?
Basic url: www.yoursite.com/forum

working url ? www.yoursite.com/forum/scripts/js ???? ore without www.
Reply With Quote
  #32  
Old 26 Oct 2010, 13:51
DjEddie DjEddie is offline
 
Join Date: Nov 2007
Originally Posted by starman™ View Post
Is the URL in the script code for the js file pointing to the right place?
hi .. yes its pointing to the right place, it has been double checked ..

also when trying this on the widget cms side .. it only shows todays date in the countdown area .. so forum block and widget aren't working for me atm :S

thanks for the help
Reply With Quote
  #33  
Old 27 Oct 2010, 02:59
Cooleyvol Cooleyvol is offline
 
Join Date: Jul 2006
I need some help on creating a side block. I paste the code in when creating a block and have already added a calendar event.

When I go to the forum, all it shows is the code.


What are the selections I need to choose when creating a side block using this code?
Reply With Quote
  #34  
Old 28 Oct 2010, 13:09
JohnKF JohnKF is offline
 
Join Date: Oct 2010
When you create a Forum Block you need to select PHP in the Content Type section.
Reply With Quote
  #35  
Old 28 Oct 2010, 13:24
JohnKF JohnKF is offline
 
Join Date: Oct 2010
Use Image or Format Text

The code uses the title of the event in the calender to display above the countdown.

I suggest you create a calendar specific to Countdown Events and set it for Admin view only; as long as you set the correct calender ID in the code it will still be picked up.

To have a picture make the Title of the event in the calendar the HTML to display the picture. For example in the forum I look after I have the following as an event title...


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.

You can see this at http://www.buckshawvillage.com/forum.php

You can use whatever HTML you like in the event title.

The code on that site is set up a little different to that posted here. Seconds are not shown until less than 24 hours. At zero there is a firework display over the page which lasts for 1 minute. Other than that it functions the same and the HTML title will work fine.

Last edited by JohnKF; 28 Oct 2010 at 13:30.
Reply With Quote
  #36  
Old 28 Oct 2010, 19:10
Cooleyvol Cooleyvol is offline
 
Join Date: Jul 2006
Originally Posted by JohnKF View Post
When you create a Forum Block you need to select PHP in the Content Type section.

I did select php and then pasted the code in. As I said, once I create an event in the calendar, the side block shows the code I input from here instead of the event countdown.

I'm sure its something simple, but I don't know how else to paste code and choose 'php' as the content type.
Reply With Quote
  #37  
Old 29 Oct 2010, 23:06
Cooleyvol Cooleyvol is offline
 
Join Date: Jul 2006
It was something simple. I'm a doofus.
Reply With Quote
  #38  
Old 30 Oct 2010, 09:11
JohnKF JohnKF is offline
 
Join Date: Oct 2010
Originally Posted by Cooleyvol View Post
It was something simple. I'm a doofus.
Share it with us please; it may help others who make a similar mistake.
Reply With Quote
  #39  
Old 30 Oct 2010, 13:32
Cooleyvol Cooleyvol is offline
 
Join Date: Jul 2006
I didn't put the line of code in the template as instructed. haha.

I did input my first event and the countdown was off by an hour, so I deleted the event and put it up again an hour different, but the countdown remained the same.

Any way to clear that? Is it cached?
Reply With Quote
  #40  
Old 30 Oct 2010, 14:32
JohnKF JohnKF is offline
 
Join Date: Oct 2010
You need to set the cache time to 1 minute.

For a widget this is done via the Configure link.
For a forum block this is done via the Edit link.

If the cache time is set too high, say 60 minutes, then a visitor may get a countdown that could be up to an hour out of date.

Even at 1 minute it will take up to 1 minute before a change in an edited event is replicated in the countdown.

If you're in a time zone that's currently using DST you should check your event as soon as DST ends as it may be an hour out in the countdown.
Reply With Quote
  #41  
Old 30 Oct 2010, 17:21
Cooleyvol Cooleyvol is offline
 
Join Date: Jul 2006
Thanks, bro! That took care of it!
Reply With Quote
  #42  
Old 04 Nov 2010, 04:23
OldSchoolDSL OldSchoolDSL is offline
 
Join Date: Oct 2010
Real name: Adam H.
I'm having a hard time getting it to work on my site. It should be counting down to New Years, but rather it keeps counting down to the end of Day Light Savings time. I'm very sure the event is ID 1 is for new years on my calendar

Last edited by OldSchoolDSL; 04 Nov 2010 at 04:37.
Reply With Quote
  #43  
Old 04 Nov 2010, 09:27
JohnKF JohnKF is offline
 
Join Date: Oct 2010
Originally Posted by OldSchoolDSL View Post
I'm having a hard time getting it to work on my site. It should be counting down to New Years, but rather it keeps counting down to the end of Day Light Savings time. I'm very sure the event is ID 1 is for new years on my calendar
The only ID you can change is the $event_calendarid which should be set to the calendar id that you want countdown events to come from. Calendar ID 1 is most likely your default calendar. I would recommend creating a new calendar for admin view only which can contain only events that should appear in the countdown. Doing this allows you to include HTML in the title for pictures, formatting, etc. and prevents anyone else seeing what events you have set for a countdown.

When you select a calendar you will see the ID in the address bar of your browser...
/calendar.php?calendarid=1

Also, try to always have another event ready for countdown after the first event has reached zero. The code picks up the first two events and counts down to the first one, then starts the second event countdown.
Reply With Quote
  #44  
Old 04 Nov 2010, 14:43
OldSchoolDSL OldSchoolDSL is offline
 
Join Date: Oct 2010
Real name: Adam H.
The only count down I'd like it to do is from my default calender & from my Holiday Manager. It's pointing to a revolving event (new years, 1x each year, every year).

Do you plan on release a new version to which can be easily configured via The Admin Control Panel or would I always need to edit script code?
Reply With Quote
  #45  
Old 05 Nov 2010, 11:54
JohnKF JohnKF is offline
 
Join Date: Oct 2010
It's unlikely that I'll create a version that's edited via the control panel as creating a special calendar for events, with permissions set to admin view only, provides all the control you need without the need to visit the control panel.
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 20:40.

Layout Options | Width: Wide Color: