utilitees

- Addons for ExpressionEngine 1.6.x

TruncHTML Documentation

Download Download

 

Installation:

Unzip the archive and copy the file pi.trunchtml.php into the plugins-directory inside your Expression Engine system-directory.

Back to top

 

Usage example:

Wrap any text/html you want to be truncated inside an {exp:trunchtml}-tag-pair.

{exp:trunchtml chars="300" ending="<a href='{path=site/comments}'>read on</a>"}{body}{/exp:trunchtml} 
Back to top

 

Parameters:

chars="100" 

Defaults to 500. Number of characters that are to be returned.

ending="..." 

Optional. String to be added after the output.

inline="..." 

Optional. This string is placed directly after the truncated text and before any closing tags. If you want the first character to be a space, use an underscore
e.g. inline=“_continue”

exact="yes" 

If this is set, text will be truncated after exactly the specified number of chars. Otherwise text will be cut after a space to prevent cutting words in the middle.

threshold="X" 

If this is set the text will only be truncated if it at least X characters long.
Otherwise the full text is returned.

Back to top

Questions / bug reports

For general comments, brickbats & bouquets please use the form over here.
Name:

Email:

URL:


Remember my personal information
Notify me of follow-up comments?


Page 1 of 4 pages  1 2 3 >  Last »

User Talk

Mike:
2010-03-21 05:23

Thank you very much for this little plugin! It is extremely helpful and I wish I would have found it a lot sooner!



chuck:
2009-10-13 03:50

Thanks, that was it! I overwrote with the newest one from here and it worked like a charm.

Dude, this is one of those EXTREMELY useful plugins that lures you into thinking its insignificant because it’s small, but it’s actually well thought out on your part. Thanks for a great job!



chuck:
2009-10-13 03:46

Hmm, I thought from here. I’ll overwrite now and see if it works.



Oliver:
2009-10-12 19:59

Have you downloaded the plugin here or from EE’s addon repository?
If the latter is true, that would explain it, because the version hosted by EE is totally outdated.



chuck:
2009-10-12 18:30

Thanks for this addon! It’s just what I needed.

I’m having probs getting “inline” to work. Using ENDING places the “...” after a on the next line. But inline=”...”  isn’t working at all for me.

Here is my full code: {exp:trunchtml chars=“180”  inline=“_…”}{event_details}{/exp:trunchtml}



Oliver:
2009-09-14 08:34

Andrew, I was not able to replicate that behaviour. Can you provide an example where this happens?



Andrew Shields:
2009-09-10 00:59

Using TruncHTML 1.3.2, it seems that when the truncation cuts off immediately before a closing tag, none of the open tags are closed. Inserting a single additional character fixes the problem, and all the tags close properly.



Oliver:
2009-07-17 15:02

Are you using a current version or the one downloaded from ExpressionEngine’s addon repository?



Mike Johnston:
2009-07-17 00:15

I was under the impression that if i used inline=”...” it would append the text with that directly after where it cut off.

Here’s what i’m using: {exp:trunchtml chars=“200” inline=”...”}{exp:html_strip keep=“strong,em,a,p”}{simplecontent}{/exp:html_strip}{/exp:trunchtml}

Yes it does not show the ... after the text.. which i require. .Can you explain how to get that to show?

Thanks



Oliver:
2009-06-19 14:57

I meant a full text and the trunchtml-paramters that will lead to this result.