vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced CMPS > vBa CMPS v1.x (Archive - Closed for Posting) > Add-On Modules & Modifications

 
 
Thread Tools Display Modes
  #1  
Old 06-13-2004, 06:20 PM
58sniper 58sniper is offline
Member
 
Join Date: Apr 2004
Posts: 80
Default Module: Countdown to certain date

What this does: This adds a module that shows how many days before a certain date. View the demo in the upper right.

1) Go to Admincp - Styles & Templates - Style Manager - Add a new template called "adv_portal_countdown".
Insert this code into the template:

Code:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
	<tr>
		<td class="tcat"><span class="smallfont"><b>$vboptions[blockbullet] Countdown</b></span></td>
	</tr>
	<tr>
		<td class="alt2">
			<script type="text/javascript" language="javascript">
				var today=new Date()
				var theoccasion=new Date(today.getFullYear(), 08, 06)
				//Customize text to show before and on occasion. Follow grammer below:
				var beforeOccasionText="left until the 20 year reunion"
				var onOccasiontext="How come you're reading this and not at the reunion?"
				var monthtext=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec")
				theoccasion.setMonth(theoccasion.getMonth()-1) //change to 0-11 month format
				var showdate="("+monthtext[theoccasion.getMonth()]+" "+theoccasion.getDate()+")" //show date of occasion
				var one_day=1000*60*60*24
				var calculatediff=""

				calculatediff=Math.ceil((theoccasion.getTime()-today.getTime())/(one_day))
				if (calculatediff<0){ //if bday already passed
					var nextyeartoday=new Date()
					nextyeartoday.setFullYear(today.getFullYear()+1)
					calculatediff=Math.ceil((nextyeartoday.getTime()-today.getTime())/(one_day)+calculatediff)
				}

				//Display message accordingly
				var pluraldayornot=(calculatediff==1)? "day" : "days"
				if (calculatediff>0)
					document.write("<span style=\"color: #ff0000; font-weight: bold;\">"+calculatediff+"</span> "+pluraldayornot+" "+beforeOccasionText+"!")
				else if (calculatediff==0)
					document.write(onOccasiontext+" "+showdate+"!")
			</script>
		</td>
	</tr>
</table>
<br />
Update the line that reads
var theoccasion=new Date(today.getFullYear(), 08, 06)
to suite your desired date, etc.
Save the template!

2) Still in your Admincp - vBa CMPS - Add Module

- Module Title - Countdown
- Module Identifier - Leave blank
- OR Template to Include - countdown
- Activate and select the column you want it in.
- Save and you are done.

Last edited by 58sniper; 06-13-2004 at 07:07 PM.
  #2  
Old 06-14-2004, 09:43 AM
Intex Intex is offline
Member
 
Join Date: May 2004
Posts: 32
Default Re: Module: Countdown to certain date

58Sniper - thx for that. Will probably use it.
  #3  
Old 06-16-2004, 05:49 AM
lee wilde's Avatar
lee wilde lee wilde is offline
Meow
 
Join Date: Jun 2004
Location: Perth, Australia
Posts: 47
Default Re: Module: Countdown to certain date

Thanks for that - sweet!
  #4  
Old 06-16-2004, 11:13 AM
Socket Socket is offline
Junior Member
 
Join Date: Apr 2004
Posts: 14
Default Re: Module: Countdown to certain date

Cheers 58sniper
  #5  
Old 06-20-2004, 06:05 AM
Kengan Kengan is offline
Junior Member
 
Join Date: May 2004
Posts: 10
Default Re: Module: Countdown to certain date

nice mod !! thanks !
  #6  
Old 06-23-2004, 09:21 AM
poseidon's Avatar
poseidon poseidon is offline
Member
 
Join Date: May 2004
Location: Missouri
Posts: 80
Default Re: Module: Countdown to certain date

the line we update, not exactly sure how to change it to what I want. Can you explain what changes when you change stuff in that line?

Also, does this count itself down of do you have to change it yourself every day?

Last edited by poseidon; 06-23-2004 at 09:32 AM.
  #7  
Old 06-23-2004, 06:04 PM
58sniper 58sniper is offline
Member
 
Join Date: Apr 2004
Posts: 80
Default Re: Module: Countdown to certain date

Quote:
Originally Posted by poseidon
the line we update, not exactly sure how to change it to what I want. Can you explain what changes when you change stuff in that line?

Also, does this count itself down of do you have to change it yourself every day?
It counts down automatically.

The line that reads
var theoccasion=new Date(today.getFullYear(), 08, 06)
is the line you need to worry about. The today.getFullYear(), 08, 06 is the date that you're counting down to. In this case, it's 2004, 08, 06 (or for us US folks, August 6th, 2004). You can change the today.getFullYear() to, say, 2005, and the month and day accordingly.

Does this make sense?

The lines that read
var beforeOccasionText="left until the 20 year reunion"
var onOccasiontext="How come you're reading this and not at the reunion?"


can be edited accordingly to display the correct messages for your date.
  #8  
Old 06-23-2004, 06:18 PM
poseidon's Avatar
poseidon poseidon is offline
Member
 
Join Date: May 2004
Location: Missouri
Posts: 80
Default Re: Module: Countdown to certain date

Gotcha, now I got it. I was trying to make it way harder than it was. Nice addition man, thanks
  #9  
Old 06-23-2004, 08:21 PM
mholtum's Avatar
mholtum mholtum is offline
I ******* single moms.
 
Join Date: May 2004
Location: Tempe, Arizona
Posts: 1,938
Default Re: Module: Countdown to certain date

Ok, I been drining the Everclear and juice. Wish me luck I am going in..
  #10  
Old 02-24-2005, 06:43 PM
kanyewest69 kanyewest69 is offline
 
Join Date: Feb 2005
Posts: 49
Default Re: Module: Countdown to certain date

i cant see whats in quote i need this modules extremly bad please help
  #11  
Old 02-25-2005, 07:51 AM
Frankenberrie's Avatar
Frankenberrie Frankenberrie is offline
Senior Member
 
Join Date: Mar 2004
Location: USA
Posts: 135
Default Re: Module: Countdown to certain date

Likewise... wheres the module?
  #12  
Old 02-25-2005, 01:09 PM
oly51 oly51 is offline
Junior Member
 
Join Date: Jan 2004
Posts: 24
Default Re: Module: Countdown to certain date

I use Noppid's vB Countdown hack. Works great. Easy to set up and change.

http://www.vbulletin.org/forum/showt...threadid=75431

Here's a screen cap of Noppids.
Attached Images
File Type: jpg countdown1.jpg (24.0 KB, 194 views)

Last edited by oly51; 02-27-2005 at 10:53 AM. Reason: Added attachment
  #13  
Old 02-26-2005, 02:56 PM
axi axi is offline
Senior Member
 
Join Date: Feb 2005
Posts: 102
Default Re: Module: Countdown to certain date

is it possible to make it read vice versa, ie; 5th MARCH 2005, instead of March 5th etc.
  #14  
Old 02-27-2005, 01:28 AM
KW802's Avatar
KW802 KW802 is offline
Administrator
 
Join Date: Mar 2004
Location: A galaxy far, far away...
Posts: 5,030
Default Re: Module: Countdown to certain date

Axi,

Are you taking about this module or Noppid's hack on VB.org?
  #15  
Old 02-27-2005, 01:39 AM
axi axi is offline
Senior Member
 
Join Date: Feb 2005
Posts: 102
Default Re: Module: Countdown to certain date

this module :-)
  #16  
Old 02-28-2005, 08:56 PM
Mike54 Mike54 is offline
Junior Member
 
Join Date: Feb 2005
Posts: 19
Default Re: Module: Countdown to certain date

I installed this earlier today and really like how easy it was to set up. I did notice just one very small thing about it (after staring at it a dozen times...) and it was an easy fix. Here was your orginal code -

Code:
<td class="tcat"><span class="smallfont"><b>$vboptions[blockbullet] Countdown</b></span></td>
After comparing that line to some other mods, I made a couple of slight additions to that -

Code:
<td class="tcat"><span class="smallfont"><b>$vba_options[portal_blockbullet] Countdown</b></span></td>
And that got the bullets inserted, to match the other modules.

Nice module and simple enough for a newb like myself to get working.
  #17  
Old 02-28-2005, 09:03 PM
ConqSoft's Avatar
ConqSoft ConqSoft is offline
Senior Member
 
Join Date: Jan 2004
Location: Raleigh, NC
Posts: 1,364
Default Re: Module: Countdown to certain date

Here's alternate code, for a realtime countdown, that I use on my site.

You can see it on www.fireblades.org on the right.

(Attaching it, so that the code doesn't break.)
Attached Files
File Type: txt countdown.txt (2.0 KB, 91 views)
__________________
My Blog
GPS Discussion Forum

*** Please do not contact me privately for help. Thanks. ***

Last edited by ConqSoft; 03-08-2005 at 08:30 PM.
  #18  
Old 03-03-2005, 02:28 AM
trulylowcarb trulylowcarb is offline
Member
 
Join Date: Feb 2005
Posts: 44
Default Re: Module: Countdown to certain date

thanks for this, great idea!
  #19  
Old 03-06-2005, 03:37 AM
BioVader BioVader is offline
Junior Member
 
Join Date: Mar 2004
Posts: 16
Default Re: Module: Countdown to certain date

Can't seem to get the Java one to work right..
  #20  
Old 03-06-2005, 01:07 PM
mholtum's Avatar
mholtum mholtum is offline
I ******* single moms.
 
Join Date: May 2004
Location: Tempe, Arizona
Posts: 1,938
Default Re: Module: Countdown to certain date

they work great!
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weather Module cLord Add-On Modules & Modifications 157 09-08-2006 07:50 PM
Basic Module cLord Add-On Modules & Modifications 55 04-24-2006 08:45 AM
Analog Clock Module [FLASH] cLord Add-On Modules & Modifications 28 04-22-2006 10:23 AM
PayPal Module cLord Add-On Modules & Modifications 36 09-21-2005 01:08 AM
Google Module cLord Add-On Modules & Modifications 22 05-03-2005 04:49 PM


All times are GMT -4. The time now is 12:27 AM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.