Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2006-08-29 20:44:14

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: How: linebreak in article-title?

Mary’s suggestion (using CSS to set the width) is the type of solution Textpattern is designed for.

Of course, this may happen, but presumably not before a period of several years.

What do you mean?

Original heading:

A Very, Very Long Article Title Is Here, And We Don’t Want Long Titles

Wrapped heading:

A Very, Very Long Article Title Is Here, And We Don’t Want Long Titles

Works in pretty much any browser.

Offline

#17 2006-08-29 21:00:57

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: How: linebreak in article-title?

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.

As a default this is fine, except when the designer is also the content creator and needs a finer granularity of control.

—-

Actually to go to an extreme, one could use variations such as:
<code>
<txp:php>
global $thisarticle;
$titlestg = explode(” “,$thisarticle[‘title’]);
$titleout = $titlestg[ 0 ]+’ ‘$titlestg[ 1 ]’ &amp; ‘$titlestg[ 2 ]’<br /><span class=“subtitle”>‘$titlestg[ 4 ]’ ‘$titlestg[ 5 ]’</span>’;
echo $titleout;
</txp:php>
</code>

Endless possibilities.

Last edited by NyteOwl (2006-08-30 19:07:34)


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#18 2006-08-29 21:35:16

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: How: linebreak in article-title?

mary, you left just that sentence from zem’s quote, which my quote is referring to. The original order was:

zem wrote:

(Think: what happens when you change your design, and hundreds of titles now break in the wrong position?)

uli wrote:

Of course, this may happen, but presumably not before a period of several years. Yet the problem is already existing, my headlines do look ugly right now.

my request was caused by the unpleasant breaking of a list of these titles:
ThermoSecure at the EuroCargo in Cologne
ThermoSecure at the DGTI 2006 in
Frankfurt
ThermoSecure at the MEDICA 2006 in
Düsseldorf
Specialist for moves with
temperature-sensitive materials
Engaged worldwide in war zones: the climate
box MX 45
Flashback: ThermoSecure at the MEDICA
2004 in Düsseldorf

there was nothing to do about by optimizing the width, it felt like sealing three holes in a water pipe at a time with only two hands: one hole is always letting water.
but even if i succeded for these: the next article title may have a sequence of words that doesn’t fit in there.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#19 2006-08-29 22:41:42

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: How: linebreak in article-title?

Wet’s objection in #5 above and even more zem’s in #12 led me to an idea: one could use Skubidu’s approach for a more flexible and overall usable way.
In the form Skubidu proposes, titles are becoming kinda … “dirty” if they weren’t sent through a form containing his code.
But this is improved easily: If an article’s author wants to break a line after a certain word/sequence of letters all he has to do is enter just that word in a custom field, and the php-function, fed with the content of the field’s value, breaks the line after the desired word. Title formatting could be done as well, adding XHTML tags to the beginning, the middle and the end of the title. This way authors are not getting in contact with tags.
Pity, that i can’t do this on my own yet. Anyone around who can and leaves it here for the posterity?

@ Nyteowl:
Dam! I haven’t read your post before I posted mine. I’m too bad in deciphering PHP, so, is your code something that would come near “my” idea? Or would it just dismantle the title?

Last edited by uli (2006-08-29 23:09:56)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#20 2006-08-29 23:30:14

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: How: linebreak in article-title?

Make/request a wordwrap plugin, if you absolutely must use linebreaks or some other character. It’s not difficult to do so (it’d take maybe 5 minutes).

Offline

#21 2006-08-30 19:08:10

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: How: linebreak in article-title?

Dam! I haven’t read your post before I posted mine. I’m too bad in deciphering PHP, so, is your code something that would come near “my” idea? Or would it just dismantle the title?

It basically takes the title string and breaks it into an array (using a space as a delimiter) where each word in the title is an element in the array. You can then format the output array as you like, even putting a seperate style on each word if you wish, including deciding where to place a line break.

(Note that I have used [ number ] for the index. There should be no spaces between the number and the brackets but textile either won’t let me do that or I haven’t figured out how.)


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#22 2006-08-30 19:38:54

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: How: linebreak in article-title?

ah, thanks for your explanations, nyteowl. then i understand at least a small tiny bit of php.

like mary proposed, i’m just writing a request for a plugin. it combines your styling proposal and skubidu’s replacing method. i hope i’ll get positive response.

and yep, textile sometimes seems to know different degrees of grace ;) i succeded only once in combining < pre > and < code >.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#23 2006-08-31 18:19:52

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: How: linebreak in article-title?

similar issue: I’d like to italicize or underline portions of my article titles, but txp:title will not recognize any html.
I used Mary’s upm_textile plugin to wrap it, and then used textile in my titles.. that worked nicely..
BUT when it comes to other tags, such as <txp:next_title /> and <txp:prev_title /> then the textile isn’t parsed.. and wrapping upm_textile around those has no effect.

I’d be grateful for suggestions on how to achieve some basic, varying styling in my article titles that will work throughout the site…


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#24 2006-08-31 21:51:48

whatbrick
Member
From: Texas
Registered: 2006-03-13
Posts: 100

Re: How: linebreak in article-title?

It’s not that it doesn’t recognize any html, it just converts all arrow brackets into unicode (as well as single-quotes and double-quotes). All the markup is still stored in the database.

If you run some tests, you should see that although <txp:title /> converts brackets, neither <txp:next_title /> nor <txp:prev_title /> do, so any markup you have in the title will appear correctly with those tags.

The piece of php I offered in an earlier post stripped out the function that converted the brackets, thus allowing you to use any and all markup in the title. However, stripping out that function means that if you wanted to include a greater-than or less-than sign in the title, you would have to do the conversion yourself, or it will not validate.

Actually, looking at it again, the snippet should be:

<txp:php>
     global $thisarticle;
     echo $thisarticle['title'];
</txp:php>

Hey, uli, I found your problem. :) That’ll teach me to test cut/paste jobs.

Last edited by whatbrick (2006-08-31 21:53:12)


Do not taunt the Markup Monkey!

Offline

#25 2006-08-31 22:46:15

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: How: linebreak in article-title?

hi whatbrick, thanks much for that.. that does solve the prev_title/next_title and txp:title tags…
but then <txp:recent_articles /> doesn’t parse the html…. :-/
seems like plugging the problem one way works with some tags, but doesn’t work consistently across all the Textpattern tags.

I really do need a way to underline, italicize, or bolden portions/specific words in some of my article titles.
I might have to hack it together using custom fields or something?
But would be really nice if I could just use the regular titles..


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#26 2006-08-31 22:49:51

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: How: linebreak in article-title?

whatbrick:

Hey, uli, I found your problem.

glad that it was nothing on my side. i’m too fresh with txp to be capable of judging which part of the engine exactly needs my attention.
and great to hear that at least i can use tags in titles from now on (i don’t want to expect this of html laymen), even before a more versatile plugin for this task gets written.

@ all: i got this thread on the road as a reservoir for ideas about what a plugin might do.

Last edited by uli (2006-08-31 22:53:48)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#27 2006-09-01 01:06:38

whatbrick
Member
From: Texas
Registered: 2006-03-13
Posts: 100

Re: How: linebreak in article-title?

The big problem is getting the titles to appear their best in any/all situations. The markup you choose for the main title may look odd when listed using the <txp:recent_articles />, <txp:related_articles />, <txp:page_title /> or <txp:recent_comments /> tags (or any others that I may have left out).

It should be interesting to see what developes.


Do not taunt the Markup Monkey!

Offline

#28 2006-10-05 22:49:04

bluearc21
Member
From: US.VA
Registered: 2004-02-24
Posts: 62
Website

Re: How: linebreak in article-title?

Not sure if this has been addressed in other threads (tried a search), but I wonder if someone could tell me how to tell Textpattern not to convert spaces to <code>&nbsp ;</code>? It’s barking with sfir.

Thanks!


“If you build it, they will come.”

Offline

#29 2006-10-06 20:48:30

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: How: linebreak in article-title?

I second the need to be able to apply minimal, semantic formatting to article titles. For example, wanting to include an acronym or book title (which should be italicized) in an article title seems quite common. For now, we can certainly use whatbrick’s solution, but from the point of view of most authors (I think) it makes more sense to apply the html to titles, and then use html entities for brackets, etc. when you actually want to show some tags in your title. What do others think?

Offline

#30 2006-10-06 20:59:51

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: How: linebreak in article-title?

nabrown78 wrote:

I second the need to be able to apply minimal, semantic formatting to article titles.

I very much agree.


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

Board footer

Powered by FluxBB