Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Automatic line-break in <Žscription%> ?

Quote Reply
Automatic line-break in <Žscription%> ?
Is there any possibility to insert automatic line breaks after x characters into the var <%description%> ?

Did not find any hints here ...

Quote Reply
Re: Automatic line-break in <Žscription%> ? In reply to
You will have to use regexp or length function of Perl to do this....


In Reply To:

$rec->{'Description'} = substr($rec->{'Description'},0,150) . "..." if (length($
rec->{'Description'}) > 150);

in the sub site_html_link routine in the HTML_Templates.pm module.

This example basically puts ... after 150 characters...you should be able to hack the above codes to add in break lines. Of course, another solution is to use regexp for hard returns.


Eliot Lee
Quote Reply
Re: Automatic line-break in <Žscription%> ? In reply to
The problem with that is that with a variable width font, lines that contain the same numbers of characters can vary widely in length.

I had a few good examples at one time, but can't find them. The only real way to do a good break is to consider most characters to be 2's, m and w to be 3's and t,l,i to be 1's (stuff like that) and determine the length of the line based on "score". You'll not get truly even lines, but they will be much more even then if you do it any other way.

PUGDOG® Enterprises, Inc.
FAQ: http://postcards.com/FAQ