I’ve trying to create a countdown timer which counts down to the entry_date of a weblog entry. Basically the client enters a weblog event and the count down display the number of days until the event happens.
Is there a way to work out the number of days between todays date and a future weblog entry?
Moved to Plugins by Moderator
Matthew, Mark Bowen redid a plugin a while back: MB:// Countdown that might be helpful.
Hi Matthew,
Not tested but hopefully this will work :
{exp:mb_countdown date="19th September 2009" event="My Birthday"}
There are {if days <= "9"}0{/if}{days} days, {hours} hours and {minutes} minutes until {event}
{/exp:mb_countdown}Hope that helps a bit. As I say I haven’t had time to test it so if it doesn’t work then please do let me know and I’ll take a look into it.
Best wishes,
Mark
Actually scratch that I don’t think that will work as I haven’t added in the conditionals to the plugin. I have to go out just now but will take a look at adding in conditionals to the plugin a little later on and then upload a newer version plugin later on when I (sorry, IF I 😉 ) get it working.
Best wishes,
Mark
Actually thinking about it this should work :
{exp:mb_countdown date="19th September 2009" event="My Birthday"}
There are {if "{days}" <= "9"}0{/if}{days} days, {hours} hours and {minutes} minutes until {event}
{/exp:mb_countdown}It’s not the exact best way of doing things but will work until I add in some code to the plugin. Should hopefully be safe as it’s only using the days variable which is already safely set in the plugin anyway.
Best wishes,
Mark
Hi Matthew,
Excellent news. Thanks for letting me know.
When I get the chance I’ll take a look at adding it directly into the plugin instead although for now I don’t really see too much of a problem with it being done like this.
Hope everything else goes well for you.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.