06-01-2005 by l0rdphi1

Is this for you?

If you want to snip fields (cut off any characters after x number of characters) you have two choices: three dots or no dots.

Three dots method

If you want to place three dots after the text that's left after snipping use the code below in your news style.

 <Snip #: Field: NAME>

 Where # is the number of characters you want to keep and NAME is the name of the field you want to snip.

No dots method

Don't want three dots? Okay, place the code below at the top of your style.

 <PerlCode> 
*antiDotSnip = sub {
my ($text, $len) = @_;
$text = HTMLstrip($text);
return ($text =~ /([\s\S]\S*)/ ? $1 : $text);
} unless $aDSLoaded;
$aDSLoaded++;
</PerlCode>

And somewhere after the above code insert the code below.

 <PerlCode> 
*antiDotSnip = sub {
my ($text, $len) = @_;
$text = HTMLstrip($text);
return ($text =~ /([\s\S]\S*)/ ? $1 : $text);
} unless $aDSLoaded;
$aDSLoaded++;
</PerlCode>

Again, # is the number of characters you want to keep and NAME is the name of the field you want to snip. Note: If you want to snip multiple fields using this method ONLY reuse the very last code example.

Further reading

Other methods are discussed in the forums. Do a search for "snip AND methods" and you will find relevant threads.

Categories:




Page last modified on February 02, 2009, at 07:31 PM