West Highland Way weblog, James McReady is counting down the days until a sponsored charity walk is talking place.
Right now, he's providing the countdown manually by editing the text himself.
I wrote a short UserTalk script that can count down to any specified date in the future:
To use it:
The optional arguments all default to zero, causing the countdown to use midnight as the time if no hour, minute, or second are specified.
Here's a countdown to Christmas:
<% workspace.daysUntilEvent(25, 12, 2003) %>
As of the last time this page was published, there are [Macro error: Can't call the script because the name "daysUntilEvent" hasn't been defined.] days until Christmas 2003.
Here's a countdown to Millard Fillmore's 204th birthday:
<% workspace.daysUntilEvent(7, 1, 2004) %>
There are [Macro error: Can't call the script because the name "daysUntilEvent" hasn't been defined.] days until Fillmore's birthday.
Radio only runs a macro on a page when the page has been updated. If you're putting the countdown clock on your weblog's home page, you can make it publish automatically once a day using the scheduler.addTask verb:
The clock.now verb returns a value representing the current second. You can use a different value for the first argument to cause the page to be published earlier or later in the day. Just add the number of seconds until it should first be run -- for example, scheduler.addTask(clock.now() + 79200, "radio.weblog.publish()", 1440) runs it 22 hours in the future, then every 24 hours after that.