Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-09 15:28:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

smd_countdown: time to an event

Could be used as a companion to your event schedules or simply for fun. Display a time until some TXP-based event occurs; be it the time your article is posted, the time it expires, the time given in custom_2, or the time until your next visit to the optician.

Chuck the <txp:smd_countdown> conditional tag on your page and inside the container put what you want to display when the given time is reached. Anything in the ‘else’ branch is displayed until then. You can use the multi-purpose <txp:smd_time_info /> tag to pluck out various bits of time in the container.

Please note this is not a real-time counter. You could, however, use this plugin to seed the start timer for a flash/javascript plugin that did count down in real-time.

Download v0.1

Enjoy the plugin but be warned: this message will self destruct in 5… 4… 3…..

Last edited by Bloke (2009-08-24 10:49:54)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2009-08-09 23:06:52

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: smd_countdown: time to an event

cool!
I think I’m going to use it in a dj site I’m working on
and put it in the agenda page near to the next event gig.
I will post a link when I will done doing it ;)

Thank you!
=)

Offline

#3 2009-08-24 10:32:04

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: smd_countdown: time to an event

Is it suppose to actually count down the numbers to be move in real time
or just show the time left when the page load as static ?

because when I try using this plugin it just show the numbers but they are not changing in real time, just static.

Offline

#4 2009-08-24 10:44:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_countdown: time to an event

THE BLUE DRAGON wrote:

Is it suppose to actually count down the numbers to be move in real time

No. As Example 5 in the documentation states: that bit’s down to you :-)

In practical terms I couldn’t possibly choose exactly how you want to render something (like which javascript library or flash counter you want to use, how often the screen updates (every minute, second, hour, whatever), whether you want milliseconds or not, what graphics you need, etc).

It’s far too difficult to pre-empt what you might want to use the counter for. So I simply chose to supply you with a tool that generates a counter to any given event in any format you wish. How you use it, which real-time countdown plugins you use after that, or whether you decide to just display the value exactly as the plugin outputs, is your choice.

EDIT: first post edited to be more clear!

Last edited by Bloke (2009-08-24 10:49:22)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2009-08-24 18:12:05

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: smd_countdown: time to an event

OK cool thanks =)

Offline

#6 2010-06-21 20:26:32

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

Re: smd_countdown: time to an event

Hello Stef,

Thanks for creating this plug-in. It will work nicely with fundraising events.

However, the countdown is not counting down on my page. No doubt I’m missing something crucial. Here’s the facts:

  • I installed and activated your plug-in.
  • I put this tag in the Article:
    <txp:smd_countdown> Posted date has arrived.
    <txp:else /> Event hasn’t started yet.
    </txp:smd_countdown>
  • I reset the Article date to today.
  • I entered an Expires date of : December 1, 2010

The live page is at: http://www.siteground269.com/~hhcla565/events/auto-show/

Feedback is greatly appreciated. Thanks.


Living the Location-Independent Life: www.NuNomad.com

Offline

#7 2010-06-21 21:35:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_countdown: time to an event

laptophobo wrote:

the countdown is not counting down on my page. No doubt I’m missing something crucial.

If you set the article’s posted date to today, then the plugin is correctly showing you that the article has indeed ‘arrived’: by default it counts down to the Posted date. If you want to count down to the Expiry you need:

<txp:smd_countdown to="expires">

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2010-06-21 22:12:56

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

Re: smd_countdown: time to an event

Thanks for getting back so quickly,

I tried your tag, but it didn’t change anything. I tried the following:

<txp:smd_countdown to=“expires”>

AND

<txp:smd_countdown to=“expires”>
</txp:smd_countdown>

AND

<txp:smd_countdown to=“expires”> Posted date has arrived.
<txp:else /> Event hasn’t started yet.
</txp:smd_countdown>


Living the Location-Independent Life: www.NuNomad.com

Offline

#9 2010-06-21 22:31:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_countdown: time to an event

laptophobo wrote:

I tried your tag, but it didn’t change anything.

Hmmm your page is showing “Event hasn’t started yet.” to me, which means the plugin is working :-s You’re not viewing a cached version of the page are you?

You maybe need to think about the logic of the plugin a little — and I admit it can be a tad confusing. Compare your expected outcome with this, which is how the plugin operates:

<txp:smd_countdown to="expires">
   Expiry date of the article has arrived
<txp:else />
   Article has been Posted, is still current and is visible
</txp:smd_countdown>

So all the while the article’s expiry has NOT been met, you will see the ‘false’ (else) message “Article has been Posted, is still current and is visible”. As soon as the article expires, one of two things will happen:

  1. If your Advanced setting Publish expired articles is Yes, you will see the ‘true’ message “Expiry date of the article has arrived”
  2. If Publish expired articles is No, you will see an HTTP error message 410: Gone because the article has expired

Armed with the above knowledge, revisit what you actually want to display on your page — and under which circumstances you want it to appear— and adjust your messages or tag logic to suit.

I can assure you the plugin is working because your page is now showing a different message than it was before you added to="expires".

Hope that helps a bit.

Last edited by Bloke (2010-06-21 22:32:55)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2010-06-22 00:22:32

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

Re: smd_countdown: time to an event

Hi. I viewed the page in a non-cached browser.
As for what I want to do with it is, I’d like for any simple countdown: e.g.: “x-number of days to go” (or whatever is set as the default language).


Living the Location-Independent Life: www.NuNomad.com

Offline

#11 2010-06-22 00:31:48

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_countdown: time to an event

laptophobo wrote:

I viewed the page in a non-cached browser.

And? Was it any better?

simple countdown: e.g.: “x-number of days to go”

OK, so it’s like the way a competition would work then? For example, the competition opens at the Posted date of the article and runs until its expiry. And you want people to see how many days they have left to enter the competition before the expiry?

The plugin can totally help in this sort of scenario. The tag structure is exactly as you have it, you just need to use the <txp:smd_time_info /> tag to display the number of days instead of the fixed message you posted above. Plenty of examples in the plugin help should get you on the right road.

Last edited by Bloke (2010-06-22 00:35:24)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2010-06-22 01:05:37

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

Re: smd_countdown: time to an event

Re: 1st question. the countdown didn’t view.

With the new tag: nothing views. I even uninstalled and re-installed the plug-in.


Living the Location-Independent Life: www.NuNomad.com

Offline

Board footer

Powered by FluxBB