Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Maximum Description size

Quote Reply
Maximum Description size
Hello

I recall that there was a discussion about limiting the Description size to a maximum number of letters..
Can anyone refresh my memory on how to do so?

Or may be point the forum as I could not find it through the search.
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Maximum Description size In reply to
Do you want to do it overall, or just in a template? (i.e decide how much is shown).

If you want to do it overall, just update the "Description" field via Database > Links > Properties, and edit the "length" in there. That should do it :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Maximum Description size In reply to
Hi Andy

I want the USER to be able to submit any lenghth description they want..

BUT when it is dispalyed in the category page (NOT the Detailed page) only a set number of letters is displayed and ONLY in a small letter..

Thanks for any suggestions.
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Maximum Description size In reply to
I use the following global and call it short_description and then use the tag: <%short_description%>

sub { my $tags = shift;
my $desc = $tags->{Description} ;
length $desc < 400 and return $desc;
my $short = substr ($desc, 0, 500);
$short =~ s/\s\S+?$//;
$short .= " ...";
return $short; }

The number of characters is 400 in this one, but you can change the number to what you like.

--Frank
Quote Reply
Re: [FrankM] Maximum Description size In reply to
Here is the same short description global except it formats the text.
You may be able to modify this to use "ONLY in a small letter"

sub {
#Displays the Description Short and formatted with line breaks.
my $tags = shift;
my $Description = $tags->{Description};
$Description = GT::CGI::html_escape($Description);
$Description =~ s/\n/<BR>\n/g;
$Description =~ s,\[(/?i)\],<$1>,g;
$Description =~ s,\[(/?b)\],<$1>,g;
length $Description <100 and return $Description;
my $short = substr ($Description, 0, 100);
$short =~ s/\s\S+?$//;
$short .= " ...";
return $short;

}

Regards

minesite
Quote Reply
Re: [minesite] Maximum Description size In reply to
Thanks so much..
That works great..
I could not get it to force small letters..BUT it does half of what I wanted it to..

Thanks again.
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Maximum Description size In reply to
Quote:
I could not get it to force small letters..

What parts were you trying to lowercase? You could try;

Code:
return $short;


...to something like;

Code:
return lc($short);


Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Maximum Description size In reply to
That worked

Thanks
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Maximum Description size In reply to
Or better for description capitalize the first letter of the sentence only:


Code:

return ucfirst lc($short);


Koki