Or, if you don't really want the words to get cut off midway;
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!
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!