EE Plugin: Multipurpose Limiter
One of my side jobs has warranted the creation of a simple little plugin to limit output by standard english delimiters (paragraph, sentence, word, character).

Download: Multipurpose Limiter


This plugin permits you to limit text by character, word, sentence or paragraph.

Usage

Wrap anything you want to be processed between the tag pairs:

{exp:limiter type="value" }
text you want processed
{/exp:limiter}

type is one of the following: paragraphs, sentences, words or characters.
value is a numeric value.

(Note: limiting by characters will leave words intact so you might get a few extra characters.)

It is possible (and even desired) to specify multiple options. The plugin works through the options in a backwards manner, starting with paragraphs and then on down to characters. The output of each defined limit is applied to the subsequent limit.

Example: The request {exp:limiter paragraphs="1" words="50"} will yield the first paragraph of the tagged text. However, after the paragraph is trimmed, the result will be trimmed down to 50 words (unless the paragraph is already shorter than that value). Switching the order of the limits does not effect the behavior; it always processes from the largest element (paragraphs) to the smallest (characters).

Hope that helps someone.

Trackbacks
The trackback URL for this entry is:
Trackbacks are disabled for this entry
Comments
Post Your Comment
Commenting is not available in this weblog entry.
Categories
Archives
March 2010
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Complete Archives

Tools
Search:
  Advanced Search

Mailing List:



Currently Reading
Recently Read
Animal Farm

Animal Farm
George Orwell

Life of Pi

Life of Pi
Yann Martel

The Fourth K

The Fourth K
Mario Puzo

Catch 22

Catch 22
Joseph Heller

the Sicilian

the Sicilian
Mario Puzo

The Quantum Rose

The Quantum Rose
Catherine Asaro

Members
Sponsors
Blogroll
Links
Stats
Entries: 2147
Comments: 2925
Trackbacks: 665
Members: 258

Most Recent:
  Entry: 11/09/08 9:38
  Comment: 11/17/08 12:27
  Visitor: 03/19/10 12:04

Powered by:
  ExpressionEngine

Extreme Tracking