Hi,
Yeah, don't see why not.
Try this global:
split_by_words
Code:
sub {
my $word_limit = $_[0];
my $phrase = $_[1];
my @split = split / /, $phrase;
if ($#split <= $word_limit) {
return {
Description => $phrase,
Description_Rest => ''
}
} else {
my (@back,@back_rest);
for (my $i = 0; $i < $word_limit; $i++) {
push @back, $split[$i];
}
for (my $i = $word_limit; $i < $#split; $i++) {
push @back_rest, $split[$i];
}
return {
Description => join(" ", @back) . "...",
Description_Rest => join(" ", @back_rest)
}
}
}
<%split_by_words(20,$Description)%>
..then call with:
<%Description%> for the shorted version, and <%Description_Rest%> for the rest of the description.
The "20" is the number of words you wanna show.
Untested, but should work.
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work! Want to give me something back for my help? Please see my
Amazon Wish List GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500) Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin |
Pre-Made Template Sets |
FREE GLinks Plugins! Compare our different Plugin packages *new* Free CSS Templates