This plugin basically does the same as the Character Limiter plugin but aims to do it in a “HTML-safe” way.
When counting the characters it ignores HTML-Tags. It does not truncate the text inside HTML-tags and it closes tags that are left open after truncating the text.
This is almost what I’m looking for! The main issue I’m having is that I can’t add an ellipsis (…) to the end of the truncated HTML - an ellipsis gets plopped in after the last closing tag, which is generally a paragraph tag, which means the ellipsis is always on the next line. And the link at the end always shows up on the next line then, too. It’s hard to account for those closing tags as they could almost be anything, I know.
I think it would be nice to have the ellipsis attached to the last characters of the excerpt, and then the “Read On” link could show on the next line. Is there a good way to approach that?
If you download the latest version from the link in the first post of this thread, there’s a new parameter named inline=”“. What you put in there will be added after the truncated text and before any auto-closed tags.
I’ve just downloaded the latest version and the inline parameter is a good addition, thanks.
My only gripe is that the plugin automatically inserts a single space before the inline text. Is there any chance you can adjust this so that the inline parameter text sits tight to the text of the entry? Then users could insert a space into the inline parameter if they wanted it? Or could have it tight? So giving people either option.
Here’s an example, I want to add ‘…’ after the end of the posts that are truncated, yet it looks a bit silly when my text reads:
This is my text …
I’d prefer if it were possible to sit tight, like this:
This is my text…
This would be especially true for when using the ‘exact=yes’ parameter as it would make cut-off words look neater.
What do you think? That’s my only comment for making this plugin perfect for me! It doesn’t look noticable when you look at it above, but on a website with larger text it does make a difference I think.
Thanks for your hard work,
Ste
Here’s an example, I want to add ‘…’ after the end of the posts that are truncated, yet it looks a bit silly when my text reads:This is my text …I’d prefer if it were possible to sit tight, like this:This is my text…
sm9 - If you want to change that yourself without waiting for an official new release, I believe all you need to do is change line 93 from
$truncate .= " " . $inline;
to
$truncate .= $inline;
I could be wrong, but that is where the space is being added.
Here’s an example, I want to add ‘…’ after the end of the posts that are truncated, yet it looks a bit silly when my text reads:sm9 - If you want to change that yourself without waiting for an official new release, I believe all you need to do is change line 93 fromThis is my text …I’d prefer if it were possible to sit tight, like this:This is my text…to$truncate .= " " . $inline;
I could be wrong, but that is where the space is being added.$truncate .= $inline;
Ahh, thanks mdesign, I’ll give that a go! 😊
Ste
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.