2012-06-20 08:06:07

gaekwad
Member
lambda
Real name: Pete Cooper
From: CrackingtonHaven, Cornwall, UK
Known languages: en-GB
Website

<txp:expires formatting - &nbsp; instead of space

Hi.
I’m using expires to output the expiry time/date of a single article. It’s being used within a table context and as the table is dynamically sized, the result is spreading over two lines. I’d like to be able to replace the space characters in the output to &nbsp; characters so the line isn’t broken – that is, it’s a single line.

I’m using this syntax:

<div style=“text-align:center;”><txp:expires format=”%b %d, %Y” /></div>

Right now, I have this as a result:

Jan 01,
2013

…and I’d like to have

Jan 01, 2013

I can get around this by forcing the <td> to be a fixed/minimum width, but I’d prefer not to if it can be avoided in a native way. I can see the most logical fix would be to change the output to use &nbsp; instead of space, though I’m definitely open to other advice.

Thanks in advance.

Last edited by gaekwad (2012-06-20 08:06:58)

Offline

 

2012-06-20 08:37:42

Gocom
Developer
omega
Real name: Jukka Svahn
Website

Re: <txp:expires formatting - &nbsp; instead of space

gaekwad wrote:

I’d like to be able to replace the space characters in the output to &nbsp; characters so the line isn’t broken – that is, it’s a single line.

Well, you can use anything in the format, including HTML as you see fit. If you want non-breaking space there, you can use one. E.g.

<txp:expires format="%b&#160;%d,&#160;%Y" />

Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

 

2012-06-20 08:38:11

Bloke
Developer
omega
Real name: Stef Dawson
From: Leeds, UK
Known languages: Engl(ish)
Website

Re: <txp:expires formatting - &nbsp; instead of space

I’d say that:

<div style="text-align:center;"><txp:expires format="%b %d,&#160;%Y" /></div>

would be the simplest option.

Of course, Gocom was faster, and Textile ate my & # 160 ;

Last edited by Bloke (2012-06-20 08:39:19)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

 

2012-06-20 08:45:31

gaekwad
Member
lambda
Real name: Pete Cooper
From: CrackingtonHaven, Cornwall, UK
Known languages: en-GB
Website

Re: <txp:expires formatting - &nbsp; instead of space

Gocom and Bloke – thank you, you’re both absolutely right. Big appreciation, thanks for your time and input.

PS: it’s pretty obvious when you say it out loud…how embarrassing.

Last edited by gaekwad (2012-06-20 08:46:08)

Offline

 

Powered by FluxBB