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+..." $>
This page was last updated on 2011-04-27, 04:56.

3 Notes

Is there a way to add ellipsis to the end only IF a title gets trimmed?

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.

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

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.