Gossamer Forum
Home : Products : Links 2.0 : Customization :

Truncate text of Description field on Search Results

Quote Reply
Truncate text of Description field on Search Results
I'm using a custom search results template where the Description field is printed under the link Title. I'd like to output only the first 100 characters of the Description, and end it with " ..." if there is additional text.

In searching the forums, I found a thread which references truncating the Title field using the following code: $link{'Title'} =~ s/^(.{25}).*$/$1.../;

Can anyone help me figure out how to modify this for the Description field? And where do I place it? In search.cgi, and/or in site_html_templates? I've tried a couple of things but no cigar.

Thanks -
Quote Reply
Re: [RickG] Truncate text of Description field on Search Results In reply to
If anyone is interested, I found the solution by searching through the DBMan forum (thinking the concept would be similar).

http://gossamer-threads.com/...threaded;post=118844

Thanks to LoisC. Works perfectly.