[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Truncating Search Results
Maybe something like:
[calc]
$max_length = 100;
$out = q{[PREFIX-description]};
if (length($out) > $max_length) {
# chop it down to max length
$out = substr($out,0,$max_length);
# now remove any char's up to & include last space
# because we may have chopped up word
$out =~ s/ [^ ]*$//;
# now tack on ' ...' to indicate there is more.
return $out . " ...";
}
return $out;
[/calc]
Could make it a user-tag if you need to reference it in many places.
Kyle (KC)
At 07:22 PM 5/14/01 , you wrote:
>Hi,
>
>I am currently displaying the category (custom field), description and
>comment fields. Unfortuantely, some of my comment fields are very long,
>and I would like to truncate them to ~100 characters or so. Anyone know
>of a way to do this?
>
>thanks,
>.cfg
>
>_______________________________________________
>Interchange-users mailing list
>Interchange-users@lists.akopia.com
>http://lists.akopia.com/mailman/listinfo/interchange-users
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users