Not a developer? Go to MovableType.com

Plugin and Theme Directory

SmartTrim v2.0

By François Nonnenmacher
Posted December 23, 2009, in Developer.

Details

SmartTrim is a plugin for Movable Type 4 that aims to provide a smarter trimming global modifier than words or trim_to.

The stock MT global modifier words cuts at a certain number of words without any control on the resulting length, it will also remove all HTML tags. trim_to cuts to a specific length but can cut a string in the middle of a word and can also output invalid HTML in the form of unclosed tags.

SmartTrim: - trims a string to a target character length without cutting words - will close any unclosed tags if the source contains HTML - can append an optional ending string like an ellipsis to the result

Requirements

Install tidyp and html-tidy (or HTML::Tidy from CPAN)

Compatibility

Movable Type versions: 4.3


Back

4 Comments

gagnerargent on January 12, 2010, 11:34 a.m. Reply

Needed this badly. Thanks.

Meilleur site poker on June 7, 2010, 8:58 a.m. Reply

Thanks.

Avocat on June 27, 2010, 4:35 a.m. Reply

Really Thanks, Francois

Mihai Bocsaru on November 2, 2010, 11:49 a.m. Reply

Another excellent movable type plugin François!

For handling the words modifier formatting I’m using the “Better Word Limit” plugin, but yours is excellent for trimming purposes.

Thanks a lot!

Leave a Comment

François Nonnenmacher

Founder of Ubiquitic, a web consultancy based in Noumea, New Caledonia. François has more than 10 years of experience with Movable Type (from the time it was just Mena and Benjamin Trott in a garage!) and has implemented it in small and big business sites, such as the blogs of the Capgemini Group, as well as the blogs of Le Figaro, the first online news site in France.

Website: http://ubiquitic.com/
Twitter: @François Nonnenmacher