The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
New vBCode Tags: [Countdown] and [Countup] timers for users Details »» | |||||||||||||||||||||||||||
New vBCode Tags: [Countdown] and [Countup] timers for users
Developer Last Online: Feb 2003
Have you or any of your members ever had the need or desire to post a countdown or countup in a post?
Something that automatically shows the remaining days, hours, minutes and seconds of that upcoming Walt Disney World trip? Or want to show everyone how many days, hours, minutes and seconds that the user has gone without a cigarette, drink, sex? - LOL I came up with this one here. It basically gives your users two new vB Code Tags, [countdown] and [countup]. Now there is no need to worry that the user will mess up your threads with incorrect JavaScript. All they have to do is use these tags, just like most other tags. For counting down, they would just have to do the following: [countdown=May 21, 2002 12:32 PM EST;We are off to see Mickey Mouse;RED]My Walt Disney World Trip Begins in [/countdown] Same for counting up with just different text of course. I guess this would qualify as a hack as you do need to change one field in the database to store this. Luckily, it's in a very small table so it should not slow anything down in theory. Modify the database Modify the field bbcodereplacement in the bbcode table to increase the storage size. Change the field properties from varchar(200) to LONGTEXT. This is needed for the new vB Code replacement to follow. I used phpMyAdmin which is very easy to use for this change. Add new JavaScript Add the following JavaScript code to your Style under Head Insert preferrably at the bottom. Be sure to do this for every style that you defined in your database. PHP Code:
Using the Admin CP, add the following; vB Code tag ----------------------------------------------------- countdown vB Code replacement ----------------------------------------------------- PHP Code:
----------------------------------------------------- [countdown="May 4, 2002;Currently At WDW Now;BLUE"]My Countdown to Disney World[/countdown] vB Code explanation ----------------------------------------------------- Enter any text you would like to say to your members here. Use {option} ? ----------------------------------------------------- Select YES Add the [countup] tag next; vB Code tag ----------------------------------------------------- countup vB Code replacement ----------------------------------------------------- PHP Code:
----------------------------------------------------- [countup="May 4, 2002;Waiting for my last cigarette;RED"]Smokefree Days[/countup] vB Code explanation ----------------------------------------------------- Enter any text you would like to say to your members here. Use {option} ? ----------------------------------------------------- Select YES There are many variations that can be use here for how the text field looks. We can post suggestions here for everyone to share I can post a screenshot tomorrow if you would like. It's really just a text field containing the days, hours, minutes and seconds of the timers with the {param} text over it. Edit: Reformatting some of the text as the PHP blocks are very wide. Also fixed a case conversion that the PHP code tag is making in my post. Show Your Support
|
Comments |
#2
|
|||
|
|||
demo or screen?
|
#3
|
||||
|
||||
OMG Kevin you are SO awesome! :cheeky: Thank you SO much, I will give you full credit on my site, You are too cool. :rambo: Thank you so much!!
|
#4
|
||||
|
||||
wow great job. this is awsome.
|
#5
|
||||
|
||||
I'm too lazy to install this unless I know what it actually looks like. Please post a demo or screenshot
|
#6
|
||||
|
||||
Nice man. Here is a image.
|
#7
|
||||
|
||||
ummsmm... Seems very interesting and useful! Thanks Kevin!
|
#8
|
|||
|
|||
Uhm, the countdown is managed by the javascript? Not client-side? - little bit disappointing.. but I most surely LIKE this .. would be very cool to have this on vB3 in the calendar in many ways I can think of
|
#9
|
||||
|
||||
It's a very useful hack and idea is very nice either, congratulations!
Just one tiny concern in my side: You (and your members) will use the vbcode for a few messages only, however the java code in the header will be loaded with every page (not just for messages either, with even in calender or user CP pages) in your board. Maybe it could be nice to check the message inside "showthread.php" before displayed whether vbcode exits or not and if it exits, make the neccessary parsing inside the same script again. This method both saves you from the java header and it could also be possible to count down according to thread reader's local time Even if you wouldnt regard this method, adding the java code to a relevant template (which is related to thread displaying only) can help to get rid of it for at least unrelevant pages. Just my 0.2 cents. Congratulations again! Logician |
#10
|
||||
|
||||
Quote:
Oh, and for changing the field in the DB to LONGTEXT... Why on earth would you need to be able to fit 4 GB in there? Changing it to text should be MORE than sufficient, unless you plan on having replacements bigger than 64kb, which I doubt anyone would ever need... Not that the field itself will end up bigger by the change, (unless you actually fill it, that is) but I was just wondering why it had to be LONGTEXT and not just text... http://www.mysql.com/doc/n/o/node_368.html |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|