Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-11 21:37:37

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,599
Website

Does anyone have experience with php hyphenator in txp?

The title says it all. This is something I am asked about a lot, particularly in German where composite nouns can lead to long words wrapping badly in tight columns. Hyphens are still handled by browsers differently so check out the link below and try resizing the text to see it rehyphenate dynamically. It also comes with support for a few common languages.

php hyphenator

I’m not sure which of those scripts is in use on that page and whether they all behave the same way.

Any ideas how this could be integrated with txp or as a plug-in.


TXP Builders – finely-crafted code, design and txp

Offline

#2 2008-09-11 22:33:43

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

Re: Does anyone have experience with php hyphenator in txp?

I have yet posted in four threads about hyphenation issues arising from composite nouns of the German language. And some time ago I adverted to the JS based technique developed by Mathias Nater in the German thread. So I was just about to cheer when trying PHP Hyphenator. The technique seemed matured, the known problem appeared to be gone: Searching for text succeeded! Then I tried different browsers and realized that the technique remained the same, it’s just FF3 that leaves out the ­ in searches, all the other Mac browsers I tried don’t swallow it.

I’d be very keen on this becoming pluggable. As long as major browsers don’t support searching shy’ed text maybe it should be applied like an additional parser, surrounding the tags to be treated (headlines, subheads etc.), so it won’t prevent searches in the main text areas.

How do IEs actually behave on searching through soft hyphenated texts?

Last edited by uli (2008-09-11 22:58:44)


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

Offline

#3 2008-09-11 23:05:53

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

Re: Does anyone have experience with php hyphenator in txp?

To try the technique, save this javascript as a bookmark and apply on an arbitrary page:

if(document.createElement){void(head=document.getElementsByTagName('head').item(0));void(script=document.createElement('script'));void(script.src='http://www.mnn.ch/hyph/v4/Hyphenator.js?bm=true');void(script.type='text/javascript');void(head.appendChild(script));}

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

Offline

#4 2008-09-12 06:36:39

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,599
Website

Re: Does anyone have experience with php hyphenator in txp?

Thanks for the feedback (obviously oversaw your previous threads, sorry). I didn’t know about the searching aspect. That would affect searching for text on a page with the browser’s find function but not in-built site search. Does it cause a problem for google and co, tho – can they read ­ in text?


TXP Builders – finely-crafted code, design and txp

Offline

#5 2008-09-12 12:09:19

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

Re: Does anyone have experience with php hyphenator in txp?

jakob wrote:

Does it cause a problem for google and co, tho – can they read ­ in text?

Ah, dam good you think that far. I hadn’t. Maybe this can be solved by a robot-sensitive conditional tag. I think there is such a plugin, can’t remember its name, though.

jakob wrote:

obviously oversaw your previous threads, sorry

No need for that “sorry” :) My remarks about my previous posts were intended to emphasize my interest for this issue (and as a compensation for my lack of expertise concerning PHP hyphenator ;)


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

Offline

Board footer

Powered by FluxBB