Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2014-01-31 09:04:43

etc
Developer
Registered: 2010-11-11
Posts: 5,237
Website GitHub

Re: smd_countdown: time to an event

Hi Pete (not that I’m smarter…)

if you see doLabel() in the code, that’s your guy.

Offline

#26 2014-01-31 10:23:29

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,277
GitHub

Re: smd_countdown: time to an event

Hi Oleg – thank you for the info. I’ve also had a brief back-and-forth with Stef over email and you’re right: it’s doLabel(). I will figure out a workaround.

Online

#27 2014-01-31 15:50:47

etc
Developer
Registered: 2010-11-11
Posts: 5,237
Website GitHub

Re: smd_countdown: time to an event

If you pass it through rah_replace, mind that it’s actually <br />, that your browser’s inspector displays as <br>.

Offline

#28 2014-02-01 01:21:36

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,277
GitHub

Re: smd_countdown: time to an event

It’s like you’re in my head, Oleg. I tried rah_replace with <br> and it didn’t work, so left it until I had time to investigate further. Once again you’ve saved me a bunch of time and work -thank you very much!

Online

#29 2014-02-03 11:44:45

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,277
GitHub

Re: smd_countdown: time to an event

For completeness, here’s the code I used to get around the doLabel() snag:

<h4 style="padding-top:0rem;">
	<small>Exp: <txp:if_expires>
		<txp:expires format="%b %e, '%y" /> (
			<txp:rah_replace from="<br />" to="">
				<txp:smd_countdown to="expires">
				<txp:else />
					<txp:smd_time_info display="week" label="week, weeks" />
				</txp:smd_countdown>
			</txp:rah_replace>
		)
		<txp:else />
			none
		</txp:if_expires>
	</small>
</h4>

Mucho thanks to Stef and Oleg.

Online

#30 2014-10-29 08:50:57

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: smd_countdown: time to an event

How to delete <br>

<txp:smd_countdown to="31 Dec 2014 23:59:59">
<txp:else />
 <txp:smd_time_info display="day"
           labelafter="1" labelspacer=" "
           label="d." show_zeros="0" />
 <txp:smd_time_info display="hour"
           labelafter="1" labelspacer=" "
           label="h." show_zeros="0" />
 <txp:smd_time_info display="minute"
           labelafter="1" labelspacer=" "
           label="m." show_zeros="0" />
</txp:smd_countdown>

Last edited by alivato (2014-10-29 08:54:01)

Offline

#31 2014-10-29 09:26:58

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

Re: smd_countdown: time to an event

alivato wrote #285195:

How to delete <br>

Temporary workaround: look at the post above yours :-)

Longer term (i.e. hopefully today, maybe later than that) I’m going to remove reliance on the core’s pesky doLabel() and write my own version in this plugin without the forced break.

Longer, longer term I might finally get round to fixing or improving the core’s doLabel which has been on the ToDo list since 2009…


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

#32 2014-10-29 09:28:18

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,277
GitHub

Re: smd_countdown: time to an event

alivato wrote #285195:

How to delete <br>

<txp:smd_countdown to="31 Dec 2014 23:59:59">...

You could use rah_replace (untested):

<txp:rah_replace from="<br>" to="">
<txp:smd_countdown to="31 Dec 2014 23:59:59">
<txp:else />
 <txp:smd_time_info display="day"
           labelafter="1" labelspacer=" "
           label="d." show_zeros="0" />
 <txp:smd_time_info display="hour"
           labelafter="1" labelspacer=" "
           label="h." show_zeros="0" />
 <txp:smd_time_info display="minute"
           labelafter="1" labelspacer=" "
           label="m." show_zeros="0" />
</txp:smd_countdown>
</txp:rah_replace>

Online

#33 2014-10-29 10:46:51

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

Re: smd_countdown: time to an event

Posted some changes to my github development version which should fix the annoying rogue <br> tag.

Note it’s a backwards-incompatible change, as there is no tag added at all now, so if you want to retain the old behaviour you’ll need to add labeltag="br" to your <txp:smd_time_info> tags.

There might be a better way to do this, hence I’ve not release v0.20 yet. But please report on the success or otherwise of the next version. To test it, either use Plugin Composer to upload the entire .php file from Github, or copy and paste the code block between # --- BEGIN PLUGIN CODE --- and # --- END PLUGIN CODE --- markers over the existing plugin code from the Admin->Plugins panel.

Ideas welcome on improvements or ways to retain backwards compatibility.


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

#34 2014-11-05 09:25:32

vcokl
New Member
Registered: 2014-11-05
Posts: 1

Re: smd_countdown: time to an event

And if the opportunity to make an active timer? Without refresh

Offline

#35 2014-11-05 10:10:45

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

Re: smd_countdown: time to an event

vcokl wrote #285467:

And if the opportunity to make an active timer? Without refresh

Sure, just use any of the freely available jQuery countdown timers and seed its start value from this plugin on page load.


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

#36 2019-10-18 13:50:02

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

Re: smd_countdown: time to an event

Maintenance release has been published that just registers the public tags to avoid the testing/debug warnings, and for forthcoming Txp 4.8.0 compatibility.


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

Board footer

Powered by FluxBB