utilitees

- Addons for ExpressionEngine 1.7.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

Caroline:
2011-08-15 20:21

I’m trying to get the 1.6 version to work with ol and li tags - is there a trick to this?



Oliver:
2011-06-26 19:56

Then you should look here: http://utilitees.de/ee.php/trunchtml



Anne Chr. Winness:
2011-06-26 17:26

EE 2.2.



Oliver:
2011-06-26 17:16

Are you running EE 2.x or 1.7?



Anne Chr. Winness:
2011-06-26 16:59

Hi,
When downoading a theme it said that I needed to install your plugin. Downloaded it, and then put the file pi.trunchtml.php into the folder system/expressionengine/plugins. But in the control panel it does not show up in the list of three plugins that are installed. Am I missing out on something? How do I install it?

Best regards and thanks

Anne grin



Oliver:
2011-06-04 22:04

This is the version for EE 1.7.x

For 2.x look here: http://utilitees.de/ee.php/trunchtml



blindMoe:
2011-06-02 01:20

I am having a php notice error come up when I try to use the plugin.  I am using EE 2.1.3 Build 20110411.

Here is the error:

A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: trunchtml/pi.trunchtml.php
Line Number: 48

It comes up whenever the script tries to access the global variable $TMPL

Any help would be greatly appreciated.



John de Beer:
2010-08-21 08:10

Thank you for this very useful plugin. Can you suggest a way to handle this special case?

It would be useful to have two different links, one for viewing entries longer than the number of characters to truncate to (current parameter) and a different link if the entry is shorter than or equal to the truncate parameter.

It would seem that this would require two “ending=” parameters, the existing one for entries that are longer than the specified number, and one for the case when the entry is shorter.

Thanks



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!