We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

NEW Plugin - MB Countdown…

Development and Programming

Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
PP Design's avatar
PP Design
46 posts
16 years ago
PP Design's avatar PP Design

Yet again, to my rescue - thanks, advice and help is always appreciated

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

No problem at all.

Let me know how it goes with the plugin. If there are any problems with it or any additions you’d like to see then I’ll do my best to get them done (if I’m able) as soon as I can.

Best wishes,

Mark

       
PP Design's avatar
PP Design
46 posts
16 years ago
PP Design's avatar PP Design

Works a treat, thanks loads 😉

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
Works a treat, thanks loads 😉

No problem. Glad to have been of help 😊

Best wishes,

Mark

       
Patrick Clarke's avatar
Patrick Clarke
10 posts
16 years ago
Patrick Clarke's avatar Patrick Clarke

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.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

One tiny problem,

I’ve run into a snag when I try and use it in a post, along with pi.allow_eecode

You neglected to say what your snag is? 😉

I just tried this out though and it seemed to work for me in a post though.

Best wishes,

Mark

       
Patrick Clarke's avatar
Patrick Clarke
10 posts
16 years ago
Patrick Clarke's avatar Patrick Clarke
You neglected to say what your snag is? wink

Sorry about that :lol:

It’s generating a result of ‘-14429 days.’ Otherwise it returns ‘84 days.’

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Patrick Clarke's avatar
Patrick Clarke
10 posts
16 years ago
Patrick Clarke's avatar Patrick Clarke

The entry was outputted into XHTML instead of none. I usually hide the menu for myself, so I forgot to check that.

Thanks!

-Patrick

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
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

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
15 years ago
Sue Crocker's avatar Sue Crocker

Are you going to be updating this for EE2? 😊

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
15 years ago
Mark Bowen's avatar Mark Bowen
Are you going to be updating this for EE2? 😊

If I can get my head around the way plugins are created in 2.0 then yes definitely. Do you use this plugin then Sue?

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
15 years ago
Sue Crocker's avatar Sue Crocker

Not yet, but going to want to test it on my 2.0 sites for a countdown to 2.0 release date. 😊 I did make a count up plugin for x number of days since event. 😊

31 days since I last smoked.. those kind of links.

My site has been online since…

       
Sean C. Smith's avatar
Sean C. Smith
3,818 posts
15 years ago
Sean C. Smith's avatar Sean C. Smith

Will be using this to countdown the number of days until I return to Canada…

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.