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
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!