“I work for Erskine Design in Nottingham. Which is nice. You've got choices, you can visit my homepage, take a look at the available downloads or view the blog archives. Please contact me whenever you like. Also, why not subscribe to the RSS feed.”
Truncate long passages of text without breaking words in ExpressionEngine.
The text truncator has been updated and moved to here
--- You can ignore from this line down, it's not relevant anymore and is here for archive purposes only ---
Basically this plugin...
I built this because I wanted to use it for some small text areas and couldn't find anything else that did what I wanted. It may or may not be of use to you. Feel free to recommend changes/improvements.
{exp:gms_truncator finish="<a href='/path/{url_title}'>...</a>" wrap_html="div" max="150"}</strong><br /><br />
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<br /><br /><strong>{/exp:gms_truncator}</strong>
Would produce the following html:
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since <a href="/path/the_url_title">...</a></div>
Mark Bowen ~ Wednesday, Mar 12th 2008 @ 15:12:03
Hi Glen,
Came across this plugin a few weeks ago and someone just today asked for help on the EE forums in doing just the kind of thing that your plugin does. It works a treat but the user did have a slight problem as the documentation in the back-end of EE for your plugin says :
{exp:gms_truncate}
instead of
{exp:gms_truncator}
Just thought I would let you know so that you can fix it if you want?
Great little plugin by the way though
Also it states on your site here that this plugin is 1.5 but again in the admin panel it shows as 1.0
Best wishes,
Mark
Glen ~ Wednesday, Mar 12th 2008 @ 15:22:53
Thanks Mark, I’ll get that sorted out today.
Mark Bowen ~ Wednesday, Mar 12th 2008 @ 21:48:28
Hi Glen,
No problems. Once again thanks for such a great plugin!
Also one other thing just noticed that you smileys aren’t working here in the comments?
Best wishes,
Mark
Matt Baily ~ Sunday, Mar 23rd 2008 @ 23:06:12
Glen,
This is a really useful plug-in and it is perfect for a project I am working on at the moment. Thankyou!
I do have one question though. Some of my entries are less than the max character length that I stated in the ‘max’ parameter. This content does not need to be shortened but still needs the finish string attached. When one of these shorter entries crops up the plug-in does not add the ‘finish’ string to the end.
Does the content between the tags have to exceed the value in the ‘max’ parameter for it to be acted on by the plug-in (i.e does the plug-in skip the ones where the content is shorter than the value in the ‘max’ parameter)? Is there anyway around this?
I look forward to your reply.
Cheers,
Matt
Glen ~ Monday, Mar 24th 2008 @ 16:29:53
Thanks Matt, I actually did a very stupid thing - I made changes to the plugin and uploaded the wrong version (schoolboy error I know) and I haven’t had time to sort it out. It should just return the string if it is less than “max”.
I will hopefully get a chance over the next day or two to sort the things you mention and add a couple of other features I worked out. I’ll put a follow-up comment (or maybe a new post) when it’s done so you’ll get notified.
Cheers.
Frank ~ Wednesday, May 28th 2008 @ 23:18:22
cool plugin..
Your’s is probably easier to find since its on one page. There is probably something out their in some way similar , but its probably buried at the bottoms of membership only librarie of member script submissions.
a decent PR score on your site , and a dedicated landing page to a script basically makes your plugin the ‘only one’ as far as that class. lol
Frank
<a href="http://www.ezprintsolutions.com">Full Color Printing</a
Robert Crow ~ Thursday, Jun 19th 2008 @ 18:57:01
This is really great!
Thank you!
Cheers,
Robert
Marcos ~ Monday, Jul 7th 2008 @ 19:52:09
Very useful, just what I was looking for.
House Wiring ~ Saturday, Jul 12th 2008 @ 15:22:56
Thanks for the Plug in..!
Ronnie ~ Monday, Jul 28th 2008 @ 03:14:29
Found a small error in the documentation. I think the example for allowed_tags is misleading. It should be something like allowed_tags="<a<, <p<”
Rolexwatch ~ Saturday, Aug 23rd 2008 @ 20:07:05
Hello.
We create impeccable quality replica Rolex Daytona and Submariner and sell them at a price relative to what they cost us to make.
If you buy one of our imitation Rolex watches you’ll enjoy the quality of an original for just a couple hundred bucks.
The idea is to go beyond the standard Rolex knockoff and create luxury items at affordable prices.
http://sites.google.com/site/rolexchoose/
Thanks.
Computer Repair Bournemouth ~ Friday, Sep 19th 2008 @ 20:56:55
Thanks, I wish I had found this about 6 weeks ago, but it is an elegant solution, thanks again for sharing it.