« Homepage
ExpressionEngine Text Truncating Plugin
07/07/09
Glen Swinfield
A while ago I posted, on my personal site, a plugin that truncated text in ExpressionEngine without breaking words - it removed html, wrapped it in a specified tag and added some optional link text on the end. It has been revamped and released here under the “Erskine” banner.
To take a block of text and display it, truncated to 100 characters (to the nearest word) with a read more link on the end, wrapped in a list item with a class of ‘summary’, you do this:
Example Usage
{exp:ed_text:truncate
wrapper="li"
wrapper_class="summary"
end_url="{url_title}"
end_text="Read in full ..."
char_limit="100"}
{big_long_text}
{/exp:ed_text:truncate}
This "Erskine" version of the plugin also has a new parameter 'break_words' suggested by Fred at nGen Works. This allows you to specifically request that words are broken when truncating if required.
Parameters
See the plugin usage instructions for parameter details.
Get the Plugin
- Ed_text plugin v1.0.1 (PHP5 ONLY)
Ed_text plugin v1.0.0 (PHP5 ONLY)
Change Log
- v1.0.1, 10th July 2009. Fixed error in usage example.
- v1.0.0, 7th July 2009. First release.
Glen Swinfield published this at 12:46 on 07/07/09