I have finally gotten around to cleaning up the quickie update I did to help out the Blog for America folks.
So, here is a summary of the changes in this version:
- Bugfixes:
- Changed time difference checking to look for
difference >= 0 instead of just difference > 0. This may have caused some odd behavior when time differences fell on exact boundaries.
- New Attributes:
MTCountdown / MTCountup : count_only
- A list of the specific time periods to check, seperated by a commas (e.g. "years,days,hours")
- Only periods from the following list will be considered:
- years
- weeks
- days
- hours
- minutes
- seconds
- Important: The time periods will be counted in the order they are given. If you put 'days' before 'years', the 'days' counter will gobble up all the time before checks for 'years' are performed.
Download it here:
Note: I know I have been asked this before, so I would like to head off the feature requests right now. I currently have no plans to incorporate 'months' into the list of periods checked, as months do not have a fixed length. If somebody else wants to put together the code to do that calculation, I would be happy to integrate it into the plugin, but I do not plan on doing it myself.
Posted by rayners
| Comments (10)
| TrackBack
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 ...])
Posted by rayners
| Comments (28)
| TrackBack