Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-12-14 09:41:01
- alexandra
- Member
- From: Cologne, Germany
- Registered: 2004-04-02
- Posts: 1,370
How: linebreak in article-title?
Is it possible to split an article title (permlink) into two lines?
Offline
#2 2005-12-14 10:39:43
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How: linebreak in article-title?
What do you mean, exactly? Are you talking about a line break that occurs with the article title itself, or something else?
Offline
#3 2005-12-14 11:14:10
- alexandra
- Member
- From: Cologne, Germany
- Registered: 2004-04-02
- Posts: 1,370
Re: How: linebreak in article-title?
Okay, lets say the article title is:
This is a very long article title – how
do i get a line break?
i like a line break after the – :
This is a very long article title -
how do i get a line break?
If i insert a <br />
in TXP´s title input field i do not get a line break.
Any ideas??
Last edited by alexandra (2005-12-14 12:38:49)
Offline
Re: How: linebreak in article-title?
What if you get your header div a width. By default the title will take 2 lines. (I’m using this techique in my site. example page <a href=“http://neme.org/main/262/Aerosculpture”>here</a>
Alternatively, if this is not what you are looking for, did you consider using a custom field as a kind of properly positioned ‘secondary-title’.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How: linebreak in article-title?
What about formatted titles in feeds? Wouldn’t they lack information when you used a custom field as a part of the title? I’d also suggest to delegate presentation issues to CSS and not to start using presentational markup or content stores once again.
Offline
#6 2005-12-15 00:38:17
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How: linebreak in article-title?
Yes, just give the element in question a width, either to the element itself or to the block which contains it, and the text will wrap.
Compare this:
<h1>A Very, Very Long Article Title Is Here, And We Don't Want Long Titles</h1>
and this:
<h1 style="width: 32em;">A Very, Very Long Article Title Is Here, And We Don't Want Long Titles</h1>
(I’m just using inline styling here for brevity.)
Offline
#7 2006-08-28 16:26:14
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,310
Re: How: linebreak in article-title?
I need to tear this one into daylight again, as I find a restriction of a title’s width is a restriction of my freedom as a designer, and this can not be the intention behind txp, which is offering soo much control!
Isn’t there a way of telling txp «son, pay attention to every instance of “•§¥” in between the title tags. If you come across it, convert it to “< br >”.»? A little pinch of PHP, maybe?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: How: linebreak in article-title?
You could try using something like this:
<txp:php>
global $thisarticle;
echo str_replace("-", "-<br />", $thisarticle['title']);
</txp:php>
Last edited by Skubidu (2006-08-28 18:24:06)
Offline
#9 2006-08-28 19:34:17
- NyteOwl
- Member
- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: How: linebreak in article-title?
Not sure what I did but I couldn’t get that code snippet to work. Setting the width is a kludge at best as it offers little control over where you break the line for any particular title.
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
#10 2006-08-28 22:37:51
- whatbrick
- Member
- From: Texas
- Registered: 2006-03-13
- Posts: 100
Re: How: linebreak in article-title?
Heck, you could just use this:
<txp:php>
global $thisarticle;
return $thisarticle['title'];
</txp:php>
Which would allow you to use any XHTML tags in the title.
Do not taunt the Markup Monkey!
Offline
#11 2006-08-29 00:42:06
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,310
Re: How: linebreak in article-title?
Skubidu, this is simply great! Thank you very much! This is a huge progress for my layouts. And it worked from the very first moment. Do you think you’re able to make a plugin of it? I think lots of people would be very grateful to be able breaking titles where they want them to. I found many questions here in the forum how breaking titles is to be done.
Btw, I’m just testing txp:etz_pg, which creates page breaks at the place in the article body where the author puts two new lines and the separator “[page]” in between them. So, this plugin is another replacing tool and accordingly stops working if I use your code snippet. Do you have any suggestion, a small workaround or so?
@ NyteOwl: you’re sure you replaced just < txp:title > with the lines Skubidu proposed? And note that you’ll have to replace every instance of < txp:title > in your forms if you use a separator that doesn’t make sense reading (I mention this as I prefer “§¥Œ” or similar cartoon-curse-like stuff, because authors use a hyphen very often, but not intending it to be the command for a new line).
@ whatbrick: Thank you for your code as well, though I couldn’t figure out, why this didn’t function. I’ve tested for a long time as it looked promising concerning additional title formatting, which IMO is missing yet in txp. I’ve made several changes about the way I applied it, but didn’t succeed. Did you intend it to be a replacement for < txp:title > as well?
Last edited by uli (2006-08-29 01:36:14)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#12 2006-08-29 02:34:17
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: How: linebreak in article-title?
I need to tear this one into daylight again, as I find a restriction of a title’s width is a restriction of my freedom as a designer, and this can not be the intention behind txp, which is offering soo much control!
Textpattern carefully separates design and content. It’s the designer’s job to decide the way titles are displayed, not the author who writes the title.
Mary’s suggestion (using CSS to set the width) is the type of solution Textpattern is designed for. (Think: what happens when you change your design, and hundreds of titles now break in the wrong position?)
Alternatively, consider a plugin or PHP fragment that uses PHP’s wordwrap
function.
Last edited by zem (2006-08-29 02:44:58)
Alex
Offline