Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

sab_substr

This is a simple plugin to cut a string of text at a specified character limit, then add a string to the end, like ellipses.

It will take an article title and trim it down to a specified character limit then add an ellipses. Possibly used for article navigation (prev/next) or an article list where you want to keep the titles short.

Example:
<sab_substr limit="10" trail="..."> content to take a substring of like <txp:title /></sab_substr>

will output

“long string…”

Reference

  • trail="yourText" – The string you want appended to the result. It will NOT be appended UNLESS the content was trimmed. Defaults to ….
  • limit="yourNumber" – The length of the string you want returned, minus the length of trail. Defaults to 10.
Article Request Count:
Initially released:
2005-02-19
Posted here:
24 Mar 2005
Article modified:
24 Mar 2005

You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (3)

Randy:
Hi there, great plugin…

but… is there a way to make it NOT trail the text in the middle of a piece of markup?

For example, I’ve had a couple problems where it cuts off in the middle of an image url, and really bones things.

Thanks in advance,

Randy

Those looking for this plugin (download link doesn’t work), can find a drop-in replacement at http://vanmelick.com/txp/

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern