I've been meaning to implement this for a while, but I only just now got around to it. MTCountdown provides a set of tags that will allow you to place a countdown timer in your MT templates.
Download one of the following files, unpack it, and place countdown.pl in your plugins/ directory.
The following tags are available:
- MTCountdown: container tag that takes one argument, until, in the following format: YYYY-MM-DD HH:MM:SS
- MTCountdownIfYears / MTCountdownIfDays / MTCountdownIfHours / MTCountdownIfMinutes / MTCountdownIfSeconds: conditional tags that return true if there is a positive value for years, days, etc.
- MTCountdownYears / MTCountdownDays / MTCountdownHours / MTCountdownMinutes / MTCountdownSeconds: the values calculated for the countdown timer.
Usage Example (counting down to my birthday):
<MTCountdown until="2003-05-13 14:00:00">
<MTCountdownIfYears><MTCountdownYears> years, </MTCountdownIfYears>
<MTCountdownIfDays><MTCountdownDays> days, </MTCountdownIfDays>
<MTCountdownIfHours><MTCountdownHours> hours, </MTCountdownIfHours>
<MTCountdownIfMinutes><MTCountdownMinutes> minutes, </MTCountdownIfMinutes>
<MTCountdownIfSeconds><MTCountdownSeconds> seconds</MTCountdownIfSeconds>
until my birthday.
</MTCountdown>
Update: (2003-06-07 01:10)
- Added tags for weeks ( MTCountdownIfWeeks and MTCountdownWeeks ).
Update: (2003-06-23 21:51)
- Added new MTCountup tags (they work just like MTCountdown, but counting from a past date)
- To make things a little less confusing, MTCountdown and MTCountup both take the date argument now (instead of until)
- date can now include embedded MT tags (e.g. [MTTag ...])
template_tags=MTCountdown,MTCountdownIfYears,MTCountdownIfWeeks,MTCountdownIfDays,MTCountdownIfMinutes,MTCountdownIfSeconds,MTCountdownYears,MTCountdownWeeks,MTCountdownDays,MTCountdownMinutes,MTCountdownSeconds,MTCountup,MTCountupIfYears,MTCountupIfWeeks,MTCountupIfDays,MTCountupIfMinutes,MTCountupIfSeconds,MTCountupYears,MTCountupWeeks,MTCountupDays,MTCountupMinutes,MTCountupSeconds
I could've used this one a few months ago... ;-)
This is a great plugin. Can one be created for a countup? Like if I wanted to have a count of how old my son is, day by day? Or is that just too geeky? =)
I used it on my homepage but doesn't seem to work!?! I put in "2003-12-24 17:00:00" for the date and it come back with nothing!
What did I do wrong?
I used it on my homepage but doesn't seem to work!?! I put in "2003-12-24 17:00:00" for the date and it come back with nothing!
What did I do wrong?
Very cool -- thanks. But I think I'm missing something. The countdown appears to work in that it comes up with a number of days, hours, etc. However, the numbers are all wrong. On June 25th I entered , but it says that's only 3 days away. The only thing I can figure is it gets its time from the server, and the server clock is wrong. But if that's the case, why would my blog entries be dated correctly? Any clues? Thanks!!
Very cool -- thanks. But I think I'm missing something. The countdown appears to work in that it comes up with a number of days, hours, etc. However, the numbers are all wrong. On June 25th I entered , but it says that's only 3 days away. The only thing I can figure is it gets its time from the server, and the server clock is wrong. But if that's the case, why would my blog entries be dated correctly? Any clues? Thanks!!
Very cool -- thanks. But I think I'm missing something. The countdown appears to work in that it comes up with a number of days, hours, etc. However, the numbers are all wrong. On June 25th I entered , but it says that's only 3 days away. The only thing I can figure is it gets its time from the server, and the server clock is wrong. But if that's the case, why would my blog entries be dated correctly? Any clues? Thanks!!
oops. really sorry about the multiple comments. :-|
I am having trouble implementing this plugin, no doubt due to user error. I put countdown.pl in the plugins directory, logged in to MT, then inserted your sample code from above (I copied and pasted to be sure) into a free area in my main index template. When I try to rebuild, I get the following error:
Build error in template 'Main Index': Error in tag: '' does not match
This text is below the close button:
MT::App::CMS=HASH(0x835f588) Use of uninitialized value in substitution (s///) at plugins/countdown.pl line 85.
MT::App::CMS=HASH(0x835f588) Use of uninitialized value in pattern match (m//) at plugins/countdown.pl line 92.
MT::App::CMS=HASH(0x835f588) Use of uninitialized value in concatenation (.) or string at plugins/countdown.pl line 96.
It appears that MTCountdown is not getting the until value correctly, but I'm running out of ideas on how to fix it. Can you show me the error of my ways?
Ok, right after I hit send I saw the comment about replacing until with date. Problem solved!
Thanks for the plugin!
I have this on my blog to show how long it has been up, but the timing is totally off. My code:
This blog has been up for
years,
days,
hours, and
minutes.
The results are 2 days. It looks like it resets the days every week or something.
This should work better
<MTCountup date="2003-08-29 10:00:00">
This blog has been up for
<MTCountupIfYears><MTCountupYears> years, </MTCountupIfYears>
<MTCountupIfDays><MTCountupDays> days, </MTCountupIfDays>
<MTCountupIfHours><MTCountupHours> hours, and </MTCountupIfHours>
<MTCountupIfMinutes><MTCountupMinutes> minutes. </MTCountupIfMinutes>
</MTCountup>
The times are all wrong.
Its showing 1 year 2 days, 6 hours 25 minutes
It should be 1 years 240something days 8 hours, etc etc
Oh, and what about a Countup/downIfMonths tag?
I'b getting a build error when trying to implement this plugin in my page design. Any help would be greatly appreciated. The sooner, the better!
Build error in template 'Main Index': Error in tag: '' does not match
MT::App::CMS=HASH(0x8360eb0) Use of uninitialized value in substitution (s///) at plugins/countdown.pl line 87.
MT::App::CMS=HASH(0x8360eb0) Use of uninitialized value in pattern match (m//) at plugins/countdown.pl line 94.
MT::App::CMS=HASH(0x8360eb0) Use of uninitialized value in concatenation (.) or string at plugins/countdown.pl line 98.
Great plug-in!
A month tag would be awesome for a future release.
If you could set it up so that after the last day pases it'd display "Tomorrow" instead of nothing that'd be sweet.
would it be possible for this to calculate years, MONTHS and days instead of years, WEEKS and days? just curious. very nice plugin.
My First installed plug-in and it worked great. Thank you.
This is the first plug-in I installed and I am very happy with it.
Thank you
Sean
This is the first plug-in I installed and I am very happy with it.
Thank you
Sean
I have entered the code as shown on comment entry #20 above. I changed to the correct date of Oct 12 2003, but it will only show 2-3 days vice approx 100 days.
This blog has been up for
years,
days,
hours, and
minutes.
Any suggestions?
hanx Marc
where is the MTCountupIfHours?
I set this up with a date of 2004-05-13 14:00:00
and got 3 days, 1 hours, 38 minutes, until my birthday.
So im a little lost. For those of you who got the error messages mentioned in post 26 above make sure you remove the word UNTIL - it should be
I set this up with a date of 2004-05-13 14:00:00
and got 3 days, 1 hours, 38 minutes, until my birthday.
So im a little lost. For those of you who got the error messages mentioned in post 26 above make sure you remove the word UNTIL - it should be
Is there a way to just count the number of weeks? I don't want the # of years.. but the weeks are showing the number relative the years.. I have something that's more than 1 year, but it's showing something less than 52 weeks. Any ideas?
I have never installed plugins but went and put the plug in into my plug in directory and all, but it won't work..weird...
How can I dislpay the countdown time in days only? If the date entered is 1 year from today, I want to see "365 days" rather than "1 year". I'm a newbie to MT and this is my first plugin, so apologies if this is a basic question.
Does this plugin work with MT 3.2? I have tried and been unable to get it to work.