Sep 10, 2003, 12:39 AM
Veteran / Moderator (18436 posts)
Sep 10, 2003, 12:39 AM
Post #4 of 7
Views: 2520
Or, if you don't really want the words to get cut off midway;
Code:
sub {
my $field = $_[0];
my $limit = $_[1];
my @sliced = split(" ",$field);
my ($count,$back);
foreach(@sliced) {
if ($count < $limit) {
$back .= $_ . " ";
} else {
$back .= "...";
if ($count == $limit) { last; }
}
$count++;
}
return $back;
}
<%global_name($Description,NumberOfWords)%>
Its a bit more long winded.. but it should do what you want.
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!