trim_to
Trims the input content to the requested length. Additionally, a ellipsis was introduced in the Movable Type 5.1. You can specify "N+STRING" as an ellipsis. For example when you specify trim_to="6+...", the phrase "Welcome to MT5.1" will be published as "Welcome...".
Usage ΒΆ
<$mt:EntryTitle trim_to="5" $>
<$mt:EntryTitle trim_to="5+..." $>
Erik Veland
February 9, 2010 10:04 PM | Reply
Is there a way to add ellipsis to the end only IF a title gets trimmed?
Jeremy King
replied to comment from Erik Veland
July 22, 2010 2:45 PM | Reply
You can use the count_characters attribute to set the length as a value, then test for it. Ex:
<$mt:EntryTitle trim_to="45"$> <$mt:EntryTitle count_characters="1" setvar="title_length"$><mt:If name="title_length" gt="45">…</mt:If>
Hope that helps.
Mihai Bocsaru
February 14, 2011 9:59 AM | Reply
Setting this as a variable and then checking against that variable (when the value is greater than a specific value) allows you to control for instance widgets display on busy news sites, where the posts titles vary in length.
Sample:
<mt:EntryTitle countcharacters="1" setvar="titlelength"> <div class="cell<mt:If name="title_length" gt="26"> larger</mt:If>">