Even easier would be to pass the variable in...
my $length_l = 100;
my $value = $_[0] or return "No value...";
length $value < $length_l and return $value;
my $short = substr ($value, 0, $length_l);
$short =~ s/\s\S+?$//;
$short .= " ...";
return $short;
}
..and call with;
<%global_name($FieldName)%>
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 $length_l = 100;
my $value = $_[0] or return "No value...";
length $value < $length_l and return $value;
my $short = substr ($value, 0, $length_l);
$short =~ s/\s\S+?$//;
$short .= " ...";
return $short;
}
..and call with;
<%global_name($FieldName)%>
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!