Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-08-29 08:49:48

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

Re: How: linebreak in article-title?

uli Yes, it was meant to replace the <txp:title />@ tag. It’s a slimmer version of the TXP title tag (which is just a PHP function). The only difference between what I offered and the TXP title tag is that the title text is not run through the escape_title() function, which converts arrow brackets and quotation marks into unicode.

I have no idea why it wouldn’t work for you. If you got Skubidu’s code to work, then mine is used the exact same way.


Do not taunt the Markup Monkey!

Offline

#14 2006-08-29 11:15:00

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

Re: How: linebreak in article-title?

Alex, it’s good to know that the dev team is so close to the needs of us users, that my first … feature request ever is getting answered, being a member in the forum since about only two weeks. Right now at our first meeting, let me take the opportunity to thank you for your work and your ideas and enthusiasm you are putting into txp. I really appreciate it and begin loving txp and it’s extreme flexibility and effectivity more and more.

Nevertheless I have wishes concerning txp, amongst these being the ability to control linebreaks in titles.

zem wrote:

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.

This is what I love about textpattern, I get a tool, that enables me to anticipate almost every need of a given website, keeping control over the look of every detail of my design. But a designer will never be able to foresee and thus control the display of every combination of words. So, to give authors a minimum tool for intervention like a linebreak for headlines I think is appropriate.

zem wrote:

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?)

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.
And a long headline broken like this one isn’t too good to
seize.

zem wrote:

Alternatively, consider a plugin or PHP fragment that uses PHP’s wordwrap function.

This is why I reactivated this thread, not being able to do it on my own and thus hoping for the friendly help of the community.


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

Offline

#15 2006-08-29 11:31:43

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

Re: How: linebreak in article-title?

whatbrick wrote:

I have no idea why it wouldn’t work for you. If you got Skubidu’s code to work, then mine is used the exact same way.

I’ll try it again one of the next days, maybe I made a mistake anywhere. Btw, I had deactivated etz_pg, but no improvements. Titles with linebreaks in them actually weren’t displayed anymore. But I keep the snippet, I’ll become smarter in dealing with PHP.


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

Offline

#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,310

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,310

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,310

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

Board footer

Powered by FluxBB