Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2007-06-07 10:19:00

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: How: linebreak in article-title?

Does anybody know if there is already a plugin available for formatting article titles? I checked textpattern resources but could not find one.

Last edited by alexandra (2007-06-07 10:19:23)

Offline

#32 2007-06-07 12:43:29

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

Re: How: linebreak in article-title?

There is nhn_typotuner by Nils Hörrmann for textiling titles and excerpts [there’s also one by Mary, but I don’t have the name around (—> www.utterplush.com?)], and for inserting linebreaks Juanjo Navarro’s jnm_wrap. I don’t yet know about anything for coloring single words. (textile an classes didn’t work too reliably the last time I tried)


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

Offline

#33 2007-06-07 18:20:44

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

Re: How: linebreak in article-title?

You can use the code snippet on the first page of this thread. Instead of putting <txp:title /> in your article form, use

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

Then you can use <br /> (which can still be semantic if all you intend is to specify a line break for ease of reading) in your title or any other html such as <cite>, which can come in handy if you are referencing a book in your title, for example.

Offline

#34 2007-06-07 19:50:06

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

Re: How: linebreak in article-title?

Aah, thanks, nabrown78, didn’t have in mind anymore that whatbricks snippet enables adding a span to the title. At the time of the above discussion I was satisfied with adding simple line breaks.


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

Offline

#35 2007-06-09 20:32:39

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

Re: How: linebreak in article-title?

alexandra:

Does anybody know if there is already a plugin available for formatting article titles?

I’ve recently written a little tute on how to style article titles

Last edited by uli (2007-06-11 00:07:44)


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

Offline

#36 2022-04-25 03:17:28

peterj
Member
From: Melbourne, Australia
Registered: 2005-06-02
Posts: 108

Re: How: linebreak in article-title?

15 years later but still relevant. No need for any messy methods now though – as of TXP 4.7., you can just do this:

<txp:title escape="" />

So this “My breaking<br>news” title displays as:

“My breaking
news”

tag ref

Note that this may cause weirdness wherever else the title shows up (eg search, sitemap, rss), so use with caution.

I’m only thinking of using where the title field is being co-opted into use as “big text” in a display panel or block layout within another article. Probably a safer idea is to leave the title sans html, and use custom fields if any fiddly stuff is required. Something like:

<txp:if_custom_field name="formatted_title">
    <txp:custom_field name="formatted_title" escape="" />
<txp:else />
    <txp:title />
</txp:if_custom_field>
<txp:body />

Offline

#37 2022-08-15 00:37:44

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 169
Website

Re: How: linebreak in article-title?

peterj:

Thanks for the update after all these years — very helpful!


Mark

Offline

Board footer

Powered by FluxBB