Help - Search - Members - Calendar
Full Version: Entry title length, trim_to and elipses
Movable Type Community Forum > Additional Resources > Tips and Tricks
monkeyfromx
I have the following code-

CODE
<MTEntries lastn="10">
<a href="<$MTEntryPermalink$>"><$MTEntryDate format="%m/%d/%Y"$>- <$MTEntryTitle trim_to="15" remove_html="1"$></a>
</MTEntries>


Works great, but if the entry is trimmed, I'd like to attach ellipses to the end. So I would end up with this when the page is rendered-

CODE
01/05/2004- Short Title
01/04/2004- Longer Title
01/03/2004- Even Longer Tit...


"Short Title" is 11 characters, "Longer Title" is 12 characters, and "Even Longer Title" is 17 characters trimmed to 15 then appended with ellipses.

Anyone know how to do this?
LisaJill
The closest thing I've seen is the plugin FirstNWords. But it is for words, not characters... nonetheless...

You could use this:

CODE
<MTEntries lastn="10">
<a href="<$MTEntryPermalink$>"><$MTEntryDate format="%m/%d/%Y"$>-
<MTFirstNWords n="5" append="..."><$MTEntryTitle  remove_html="1"$> </MTFirstNWords></a>
</MTEntries>


hope that helps
monkeyfromx
Well... That won't quite work... I need to limit it by number of characters so I can have greater control. If I were to limit it to 3 or 4 words and then had some really long words, my layout is hosed...

Any other ideas (plugins or hacks??)
kadyellebee
Maybe you could use Lisa's example, combined with Crys's new plugin: Trim Words by Length ??

Otherwise, some PHP would probably be your next best bet.

Kristine
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.