In reply to this thread here I have created a new version of the countdown plugin.
This one is slightly easier to use as it makes use of the strtotime() function so that you can pass in the date in a human readable way.
Usage V1.4
{exp:mb_countdown date="6th May 2010" event="My Birthday"}
<h2>Grammatically Correct Version</h2>
{if years > 0}{years} year{if years > 1}s{/if}, {/if}{if months > 0}{months} month{if months > 1}s{/if}, {/if}{if days > 0}{days} day{if days > 1}s{/if}, {/if}{if hours > 0}{hours} hour{if hours > 1}s{/if}, {/if}{if minutes > 0}and {minutes} minute{if minutes > 1}s{/if}{/if} left until {event}
{/exp:mb_countdown}
Usage V1.3
{exp:mb_countdown date="6th May 2010" event="My Birthday"}
There are {if "{years}" != "0"}{years} years, {/if}{if "{months}" != "0"}{months} months and {/if}{if "{days}" != "0"}{days} days{/if}, {hours} hours, and {minutes} minutes until {event}
{/exp:mb_countdown}
Messy yet grammatically correct V1.3 😉
{exp:mb_countdown date="6th May 2010" event="My Birthday"}
{if "{years}" > "0"}{years} year{if "{years}" > "1"}s{/if}, {/if}{if "{months}" > "0"}{months} month{if "{months}" > "1"}s{/if}, {/if}{if "{days}" > "0"}{days} day{if "{days}" > "1"}s{/if}, {/if}{if "{hours}" > "0"}{hours} hour{if "{hours}" > "1"}s{/if}, {/if}{if "{minutes}" > "0"}and {minutes} minute{if "{minutes}" > "1"}s{/if}{/if} left until {event}
{/exp:mb_countdown}
Usage V1.0
{exp:mb_countdown date="6th May 2010" event="My Birthday"}
There are {days} days, {hours} hours and {minutes} minutes until {event}
{/exp:mb_countdown}
As I have made the plugin a tag pair it means that you can lay the message out in any way you wish using the {days}, {hours} and {minutes} variables.
Hope it’s of some use.
Best wishes,
Mark
Mark-
Thanks for the work on this new pi.
I’ve run into a snag when I try and use it in a post, along with pi.allow_eecode:
{exp:weblog:entries entry_id="9" limit="1" disable="categories|category_fields|pagination|member_data|trackbacks"}
{exp:allow_eecode}
{body}
{/exp:allow_eecode}
{/exp:weblog:entries}
Where Body is:
{exp:mb_countdown date=“25th September 2010” event=”“} {days} days{/exp:mb_countdown}
It works just fine otherwise. Just thought I’d let you know.
Hmm not too sure about that. I just tested it on an install and got the correct amount of 448 sent back.
Is that code above exactly as you have it in the body field? If so then your quotes are fancy quotes which may well be messing this up for you. Try deleting them and typing them in again by hand, see if that fixes the problem maybe?
Best wishes,
Mark
The entry was outputted into XHTML instead of none. I usually hide the menu for myself, so I forgot to check that. Thanks! -Patrick
No problem, glad it’s working for you now. Have fun with it! 😊
If anyone has any suggestions for anything they want added to this just let me know and I’ll do my best.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.