Page 1 of 2 12 LastLast
Results 1 to 20 of 37

Thread: Module: Countdown to certain date

  1. #1

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

    Default Re: Module: Countdown to certain date

    58Sniper - thx for that. Will probably use it.

  3. #3
    Meow lee wilde's Avatar
    Join Date
    Jun 2004
    Location
    Perth, Australia
    Posts
    47

    Default Re: Module: Countdown to certain date

    Thanks for that - sweet!

  4. #4
    Junior Member
    Join Date
    Apr 2004
    Posts
    14

    Default Re: Module: Countdown to certain date

    Cheers 58sniper

  5. #5
    Junior Member
    Join Date
    May 2004
    Posts
    10

    Default Re: Module: Countdown to certain date

    nice mod !! thanks !

  6. #6
    Member poseidon's Avatar
    Join Date
    May 2004
    Location
    Missouri
    Posts
    91

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

    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. #8
    Member poseidon's Avatar
    Join Date
    May 2004
    Location
    Missouri
    Posts
    91

    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. #9
    I ******* single moms. mholtum's Avatar
    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. #10

    Default Re: Module: Countdown to certain date

    i cant see whats in quote i need this modules extremly bad please help

  11. #11
    Senior Member Frankenberrie's Avatar
    Join Date
    Mar 2004
    Location
    USA
    Posts
    136

    Default Re: Module: Countdown to certain date

    Likewise... wheres the module?

  12. #12
    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 Attached Images
    Last edited by oly51; 02-27-2005 at 11:53 AM. Reason: Added attachment

  13. #13
    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. #14
    Super Moderator KW802's Avatar
    Join Date
    Mar 2004
    Location
    A galaxy far, far away...
    Posts
    6,609

    Default Re: Module: Countdown to certain date

    Axi,

    Are you taking about this module or Noppid's hack on VB.org?

  15. #15
    Senior Member
    Join Date
    Feb 2005
    Posts
    102

    Default Re: Module: Countdown to certain date

    this module :-)

  16. #16

    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. #17
    Senior Member ConqSoft's Avatar
    Join Date
    Jan 2004
    Location
    Raleigh, NC
    Posts
    1,614

    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 Attached Files
    Last edited by ConqSoft; 03-08-2005 at 09:30 PM.
    My Blog
    GPS Discussion Forum

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

  18. #18

    Default Re: Module: Countdown to certain date

    thanks for this, great idea!

  19. #19
    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. #20
    I ******* single moms. mholtum's Avatar
    Join Date
    May 2004
    Location
    Tempe, Arizona
    Posts
    1,938

    Default Re: Module: Countdown to certain date

    they work great!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Weather Module
    By cLord in forum Add-On Modules & Modifications
    Replies: 157
    Last Post: 09-08-2006, 07:50 PM
  2. Basic Module
    By cLord in forum Add-On Modules & Modifications
    Replies: 55
    Last Post: 04-24-2006, 08:45 AM
  3. Analog Clock Module [FLASH]
    By cLord in forum Add-On Modules & Modifications
    Replies: 28
    Last Post: 04-22-2006, 10:23 AM
  4. PayPal Module
    By cLord in forum Add-On Modules & Modifications
    Replies: 36
    Last Post: 09-21-2005, 01:08 AM
  5. Google Module
    By cLord in forum Add-On Modules & Modifications
    Replies: 22
    Last Post: 05-03-2005, 04:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •