vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=266689

Countdown (Forum, Sideblock, vBa CMPS, Multiple Countdowns)
by Gemma
12 Jul 2011 20:26

7 Attachment(s)
Someone PM'd me last week asking for the code I use for my countdown sideblock. So here is the basic countdown (doesn't include the images/blurb that screenshots/demo show)

This countdown uses the users PC clock and calendar to count down to a time and date.

What is it?
A sideblock on your forum index to countdown to a specific date/event.

1. Upload the contents on the zip archive to your server. Keeping the file structure as is.

countdown/js/jquery-1.4.1.js
countdown/js/jquery.lwtCountdown-1.0.js
countdown/js/misc.js
countdown/style/main.css

Change the settings of the countdown/js folder to CHMOD 775

2. Go to AdminCP > Forums and Moderators > Forum Block Manager > Add Block

Title - Countdown
Description - whatever you want
Content Type - HTML
Content - <div></div>
Template to use - block_countdown

3. Go to AdminCP > Styles and Templates > Style Manager > Add New Template

Title - block_countdown

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

Change this part to set the countdown target date


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

Save the block.

4. Go to AdminCP > Style and Templates > Style Manager > StyleVars > forum_sidebar_width and change the width to atleast 270px

You can change the colour of the digits/text to suit your forum by changing references to #5C7099 in the main.css file

If you are using vBOptimise go to AdminCP > vBOptimise > Flush Cache

To have more than one countdown

Create a new template called block_countdown2


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

Set the targetDate data and save

For reference if making more blocks - (jq('#countdownX').countDown({ and <div id="countdownX"> are used to call additional countdowns).

Create a new forum block in the same way as before but make the template to use: block_countdown2

To Display on vB Advanced CMPS - http://www.vbulletin.org/forum/showp...&postcount=122

To show multiple countdowns on forumhome (screenshots) - http://www.vbulletin.org/forum/showp...&postcount=158

If you want to add images/videos etc to your countdown all you need to do is add some basic code to the template. Search for </script><div> and after that you would add something like.

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

If you are upgrading from a previous version, upload the contents of the zip file and replace the template(s) you are using (ie block_countdown, block_countdown2, adv_portal_countdown etc). Set the targetDate.

History
1.0.4 - Reverted back to using jquery-1.4.1.js
1.0.3 - Now using jquery-1.6.1.min.js and added noConflict to script
1.0.2 - Cleaned up code, added instructions to zip. Also instruction within thread on how to make CMS widget or have more than one countdown.

If anyone wants to further develop any of my addons, you are free to do so.



sadaar 12 Jul 2011 21:28

Thanks for the mod, it looks great. However, I cannot seem to set it to display anything other and 0's. I tried eliminating the cache time, I tried entering the year in both 2011 and just 11 format. Can you please post an example of a functioning time?

Gemma 12 Jul 2011 21:34


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


sadaar 12 Jul 2011 22:20

Thanks for the quick reply, unfortunately I still am not getting the countdown, just 0's

sadaar 12 Jul 2011 23:10

Again, I appreciate your support.

I downloaded the zip, upload and overwrote. I verified the directory structure. I deleted the forum block and created a new with a direct cut and paste of your's. Then pasted the sample date and time.

I still get nothing but 00's

Is it just me? Or is anyone else having this issue?

K4GAP 13 Jul 2011 05:52

Uninstalled, would not display anything but 0's.

un? in? 13 Jul 2011 07:53

Oh, don't work.
Please fix
Demo: http://raovat.vn-news.org/forum.php
Thanks

Gemma 13 Jul 2011 08:13

I don't know, it works fine on every site I've installed it on and I've used the same code on them all.


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

Replace the target date data with your own.

If no-one can confirm it working then I'll get one of the mods to delete this. Sorry :(

edit: Confirmed as working

Taurus1 13 Jul 2011 09:46

Works and looks awesome. Thank you so much!

Gemma 13 Jul 2011 09:51

Quote:

Originally Posted by Taurus1 (Post 2219936)
Works and looks awesome. Thank you so much!

If you are looking to add an image above the countdown, add something like this below </script>

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

If you want to link the image to something, ie when clicking on the image it would go to a forum post or external site use this format instead, replace the <img src="LINK TO YOUR IMAGE"> with something like this - <a href="http://www.yourlink.com"><img src="http://www.yourimagelink.com/image.jpg" alt="hover over title" width="x" height="x" /></a>

Taurus1 13 Jul 2011 10:06

OH cool! Thank you Gemma. Is there a way for me to use a longer title? When the title is too long it overlaps the box, it is not broken into 2 sentences or so.
And did you release this as widget somewhere?

Gemma 13 Jul 2011 10:21

Quote:

Originally Posted by Taurus1 (Post 2219945)
OH cool! Thank you Gemma. Is there a way for me to use a longer title? When the title is too long it overlaps the box, it is not broken into 2 sentences or so.
And did you release this as widget somewhere?

I'll look at the title part and see what's up.

You should be able to use the same code to make a cms widget but you would need to be using a sidebar of 270px or more for it to display properly

Gemma 13 Jul 2011 10:41

Quote:

Originally Posted by Gemma (Post 2219949)
I'll look at the title part and see what's up.

You should be able to use the same code to make a cms widget but you would need to be using a sidebar of 270px or more for it to display properly

Actually, I take that back :o

You'd need to use something like this for a CMS Widget


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


Kulham 13 Jul 2011 10:46

FIXED:

1.- Add before..

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

2.- Check folder permission #0775

3.- Clear Cache sideblock.

Gemma 13 Jul 2011 10:52

Thanks. I removed the jquery-1.4.1.js lines from the code because it wasn't needed for all the installs I'd made (but I left the script in the zip file). Any time you make a new widget/sideblock it is always recommended to clear or purge the cache.


All times are GMT. The time now is 02:21.

Powered by vBulletin® Version 3.8.12
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.