![]() |
|
#1
|
|||
|
|||
|
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 />
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
|
|||
|
|||
|
58Sniper - thx for that. Will probably use it.
|
|
#3
|
||||
|
||||
|
Thanks for that - sweet!
|
|
#4
|
|||
|
|||
|
Cheers 58sniper
|
|
#5
|
|||
|
|||
|
nice mod !! thanks !
|
|
#6
|
||||
|
||||
|
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
|
|||
|
|||
|
Quote:
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
|
||||
|
||||
|
Gotcha, now I got it. I was trying to make it way harder than it was. Nice addition man, thanks
|
|
#9
|
||||
|
||||
|
Ok, I been drining the Everclear and juice. Wish me luck I am going in..
|
|
#10
|
|||
|
|||
|
i cant see whats in quote i need this modules extremly bad please help
|
|
#11
|
||||
|
||||
|
Likewise... wheres the module?
|
|
#12
|
|||
|
|||
|
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. Last edited by oly51; 02-27-2005 at 10:53 AM. Reason: Added attachment |
|
#13
|
|||
|
|||
|
is it possible to make it read vice versa, ie; 5th MARCH 2005, instead of March 5th etc.
|
|
#14
|
||||
|
||||
|
Axi,
Are you taking about this module or Noppid's hack on VB.org?
|
|
#15
|
|||
|
|||
|
this module :-)
|
|
#16
|
|||
|
|||
|
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> Code:
<td class="tcat"><span class="smallfont"><b>$vba_options[portal_blockbullet] Countdown</b></span></td> Nice module and simple enough for a newb like myself to get working. |
|
#17
|
||||
|
||||
|
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.)
__________________
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
|
|||
|
|||
|
thanks for this, great idea!
|
|
#19
|
|||
|
|||
|
Can't seem to get the Java one to work right..
|
|
#20
|
||||
|
||||
|
they work great!
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |