Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications

Reply
 
Thread Tools
Countdown (Forum, Sideblock, vBa CMPS, Multiple Countdowns) Details »»
Countdown (Forum, Sideblock, vBa CMPS, Multiple Countdowns)
Version: 1.0.4, by Gemma Gemma is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: vBulletin Forum Sideblocks - Version: 4.x.x Rating:
Released: 07-11-2011 Last Update: 10-21-2011 Installs: 146
Template Edits
Re-useable Code Additional Files  
No support by the author.

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
Code:
<li>
    <div class="block smaller">
        <div class="blocksubhead">
            <a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
            <span class="blocktitle">{vb:raw blockinfo.title}</span>
        </div>
        <div class="widget_content blockbody floatcontainer">
        <div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
<script language="Javascript" type="text/javascript" src="countdown/js/jquery-1.4.1.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/jquery.lwtCountdown-1.0.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/misc.js"></script>
<link rel="Stylesheet" type="text/css" href="countdown/style/main.css"></link>
<script type="text/javascript">
var jq=$.noConflict();
jq(document).ready(function() {
jq('#countdown').countDown({
        targetDate: {
            'day':      19,
            'month':    7,
            'year':     2011,
            'hour':     23,
            'min':      59,
            'sec':     59,
            }
    });
});
</script>
<div>
        <div id="countdown">
            <div class="dash first weeks_dash">
                <span class="dash_title">Weeks</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash days_dash">
                <span class="dash_title">Days</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash hours_dash">
                <span class="dash_title">Hrs</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash minutes_dash">
                <span class="dash_title">Mins</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash seconds_dash">
                <span class="dash_title">Secs</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
        </div>
</div>
</div>
        </div>
    </div>
    <div class="underblock"></div>
</li>
Change this part to set the countdown target date

Code:
 'day':      19,
            'month':    7,
            'year':     2011,
            'hour':     23,
            'min':      59,
            'sec':     59,
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

Code:
<li>
    <div class="block smaller">
        <div class="blocksubhead">
            <a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
            <span class="blocktitle">{vb:raw blockinfo.title}</span>
        </div>
        <div class="widget_content blockbody floatcontainer">
        <div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
<script language="Javascript" type="text/javascript" src="countdown/js/jquery-1.4.1.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/jquery.lwtCountdown-1.0.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/misc.js"></script>
<link rel="Stylesheet" type="text/css" href="countdown/style/main.css"></link>
<script type="text/javascript">
var jq=$.noConflict();
jq(document).ready(function() {
jq('#countdown2').countDown({
        targetDate: {
            'day':      00,
            'month':    00,
            'year':     0000,
            'hour':     00,
            'min':      00,
            'sec':     00,
            }
    });
});
</script>
<div>
        <div id="countdown2">
            <div class="dash first weeks_dash">
                <span class="dash_title">Weeks</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash days_dash">
                <span class="dash_title">Days</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash hours_dash">
                <span class="dash_title">Hrs</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash minutes_dash">
                <span class="dash_title">Mins</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
            <div class="dash seconds_dash">
                <span class="dash_title">Secs</span>
                <div class="digit">0</div>
                <div class="digit">0</div>
            </div>
        </div>
</div>
</div>
        </div>
    </div>
    <div class="underblock"></div>
</li>
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 - https://vborg.vbsupport.ru/showpost....&postcount=122

To show multiple countdowns on forumhome (screenshots) - https://vborg.vbsupport.ru/showpost....&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.
Code:
<img alt="" title="" src="URL TO YOUR IMAGE" width="150" height="225"><br/><br/>
<iframe width="240" height="160" src="EMBEDDED YOUTUBE VIDEO LINK" frameborder="0" allowfullscreen></iframe><br/><br/>
</div>
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.


Download Now

File Type: zip sidebar_countdown1.0.4.zip (47.8 KB, 662 views)

Screenshots

File Type: jpg sideblock.jpg (68.7 KB, 0 views)
File Type: jpg arcade_count.jpg (137.3 KB, 0 views)
File Type: jpg count.jpg (70.8 KB, 0 views)
File Type: jpg countdown2.jpg (43.9 KB, 0 views)
File Type: jpg countdowns.jpg (78.4 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
9 благодарности(ей) от:
doctorsexy, fxdigi-cash, GreyGhost, Khriz, nektar, Sage Knight, tekram, WendM

Comments
  #12  
Old 07-13-2011, 09:06 AM
Taurus1's Avatar
Taurus1 Taurus1 is offline
 
Join Date: Dec 2009
Posts: 648
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #13  
Old 07-13-2011, 09:21 AM
Gemma's Avatar
Gemma Gemma is offline
 
Join Date: Apr 2004
Location: Scotland
Posts: 1,229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Taurus1 View Post
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
Reply With Quote
  #14  
Old 07-13-2011, 09:41 AM
Gemma's Avatar
Gemma Gemma is offline
 
Join Date: Apr 2004
Location: Scotland
Posts: 1,229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Gemma View Post
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

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

Code:
<div class="cms_widget">
	<div class="block">
		<div class="cms_widget_header">
		</div>
		<div class="cms_widget_content_restore_widget_content">
<script language="Javascript" type="text/javascript" src="countdown/js/jquery.lwtCountdown-1.0.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/misc.js"></script>
<link rel="Stylesheet" type="text/css" href="countdown/style/main.css"></link>
<script type="text/javascript">
jQuery(document).ready(function() {
    $('#countdown').countDown({
        targetDate: {
            'day':      19,
            'month':    7,
            'year':     2011,
            'hour':     23,
            'min':      59,
            'sec':     59,
			'utc':		true
        }
    });
});
</script>
<center>
<div>		
		<div id="countdown">
			<div class="dash first weeks_dash">
				<span class="dash_title">Weeks</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash days_dash">
				<span class="dash_title">Days</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash hours_dash">
				<span class="dash_title">Hrs</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash minutes_dash">
				<span class="dash_title">Mins</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash seconds_dash">
				<span class="dash_title">Secs</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
		</div></center>
</div>
	</div>
</div>
Reply With Quote
  #15  
Old 07-13-2011, 09:46 AM
Kulham Kulham is offline
 
Join Date: Mar 2010
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FIXED:

1.- Add before..
Code:
<script language="Javascript" type="text/javascript" src="countdown/js/jquery-1.4.1.js"></script>
2.- Check folder permission #0775

3.- Clear Cache sideblock.
Reply With Quote
  #16  
Old 07-13-2011, 09:52 AM
Gemma's Avatar
Gemma Gemma is offline
 
Join Date: Apr 2004
Location: Scotland
Posts: 1,229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #17  
Old 07-13-2011, 09:59 AM
Taurus1's Avatar
Taurus1 Taurus1 is offline
 
Join Date: Dec 2009
Posts: 648
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That unfortunately don't work for me Gemma. The widget just remains on 00. I was also trying to center in with <center></center> tags wrapped around it, but it wont center. Sorry for the trouble. And thank you so much for your help and effort!
Reply With Quote
  #18  
Old 07-13-2011, 11:44 AM
TheChief TheChief is offline
 
Join Date: Nov 2010
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Added and working fine - Exactly what i was after

Thanks
Reply With Quote
  #19  
Old 07-13-2011, 11:55 AM
un? in? un? in? is offline
 
Join Date: Jul 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Gemma View Post
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.

Code:
<script language="Javascript" type="text/javascript" src="countdown/js/jquery.lwtCountdown-1.0.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/misc.js"></script>
<link rel="Stylesheet" type="text/css" href="countdown/style/main.css"></link>
<script type="text/javascript">
jQuery(document).ready(function() {
    $('#countdown').countDown({
        targetDate: {
            'day':      2,
            'month':    9,
            'year':     2011,
            'hour':     17,
            'min':      0,
            'sec':      0,
			'utc':		true
        }
    });
});
</script>

<div>
	
		<div id="countdown">
			<div class="dash first weeks_dash">
				<span class="dash_title">Weeks</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash days_dash">
				<span class="dash_title">Days</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash hours_dash">
				<span class="dash_title">Hrs</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash minutes_dash">
				<span class="dash_title">Mins</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash seconds_dash">
				<span class="dash_title">Secs</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
		</div>
</div>
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
Quote:
Originally Posted by Kulham View Post
FIXED:

1.- Add before..
Code:
<script language="Javascript" type="text/javascript" src="countdown/js/jquery-1.4.1.js"></script>
2.- Check folder permission #0775

3.- Clear Cache sideblock.
I don't know.
My site don't work.
I did 2 you in on
Please: help me
Reply With Quote
  #20  
Old 07-13-2011, 11:55 AM
Gemma's Avatar
Gemma Gemma is offline
 
Join Date: Apr 2004
Location: Scotland
Posts: 1,229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Taurus1 View Post
That unfortunately don't work for me Gemma. The widget just remains on 00. I was also trying to center in with <center></center> tags wrapped around it, but it wont center. Sorry for the trouble. And thank you so much for your help and effort!
vBulletin's CMS is a pile of poo! It really needs an overhaul. Try this (based on a sidebar of 300px)

Upload the contents of the attached zip, CHMOD the coutdown/js folder to 775

Create a new template called vbcms_widget_countdown and copy this code

Code:
<div class="cms_widget">
	<div class="block">
		<div class="cms_widget_header">
<h3><img src="{vb:raw vboptions.bburl}/countdown/style/countdown.png" alt="" /> {vb:raw widget_title}</h3>
		</div>
		<div class="cms_widget_content_restore_widget_content">
<br/>
<div>		
		<div id="countdown">
			<div class="dash first weeks_dash">
				<span class="dash_title">Weeks</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash days_dash">
				<span class="dash_title">Days</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash hours_dash">
				<span class="dash_title">Hrs</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash minutes_dash">
				<span class="dash_title">Mins</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
			<div class="dash seconds_dash">
				<span class="dash_title">Secs</span>
				<div class="digit">0</div>
				<div class="digit">0</div>
			</div>
		</div>
<script language="Javascript" type="text/javascript" src="countdown/js/jquery-1.4.1.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/jquery.lwtCountdown-1.0.js"></script>
<script language="Javascript" type="text/javascript" src="countdown/js/misc.js"></script>
<link rel="Stylesheet" type="text/css" href="countdown/style/countdown_cms.css"></link>
<script type="text/javascript">
jQuery(document).ready(function() {
    $('#countdown').countDown({
        targetDate: {
            'day':      19,
            'month':    7,
            'year':     2011,
            'hour':     23,
            'min':      59,
            'sec':     59,
			'utc':		true
        }
    });
});
</script>
</div></div>
Change the targetDate info and save the template.

Go to vBulletin CMS > Widgets > Create New Widget

Widget Type - Static HTML
Title - whatever
Save.

Configure the new widget

Enter Static HTML - <div></div>
Template Name - vbcms_widget_countdown
Save

Then go to Layout Manager and place the widget in the sidebar you want it to appear.

Clear the CMS Cache and Flush Cache on vBOptimise (if applicable)
Attached Images
File Type: jpg cms.jpg (83.3 KB, 0 views)
Attached Files
File Type: zip countdown_cms.zip (1.1 KB, 97 views)
Reply With Quote
Благодарность от:
Poker Face
  #21  
Old 07-13-2011, 11:57 AM
Gemma's Avatar
Gemma Gemma is offline
 
Join Date: Apr 2004
Location: Scotland
Posts: 1,229
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by un? in? View Post
I don't know.
My site don't work.
I did 2 you in on
Please: help me
Can you PM me a link to your site and I'll have a look
Reply With Quote
Reply

Thread Tools

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

Forum Jump


All times are GMT. The time now is 05:30 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
  • Page Generation 0.06625 seconds
  • Memory Usage 2,401KB
  • Queries Executed 28 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (9)bbcode_code
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (9)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (8)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete