Plugin

Developer
Supported

Hacksaw

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Brett DeWoody

     

You must be logged in to post.

<a> Tags not closed causing issues with length of excerpt.

Bug Report

philecker
philecker

Having an issue with my <a> not being closed, which is causing my excerpt to be cutoff before the correct number of chars=”“, I saw another bug report of this same issue with other tags, is there a fix for this?

Kristen Grote
# 1
Kristen Grote

I’m having this problem too. If the excerpt ends in the middle of a string wrapped in HTML tags, the ending tag gets cut off. My template code looks like this:

{exp:eehive_hacksaw chars="300" append="..." allow="<p><br /><strong><a><em>"}
    {blog_content}
{
/exp:eehive_hacksaw} 

And one of my blog excerpts cuts off in the middle of a string wrapped in <em> tags, so the output looks like this:

<p>Lorem ipsum dolor sit ametconsectetur adipiscing elitNunc vitae nunc nisinon dictum elitFusce pulvinar porttitor volutpatDuis quis mauris nullaet ullamcorper nibhDuis dolor ipsumsodales sed ullamcorper ut, <em>commodo non sapien...
       
<
p><a href="/blog/my-blog-post">Continue Reading &raquo;</a></p
philecker
# 2
philecker

Kristen,

Have you found solution to this issue? I’m still looking. Thanks.

-Phil

Kristen Grote
# 3
Kristen Grote

Hi Phil,

I’m afraid not :( Looks like Brett isn’t actively supporting this add-on anymore. TruncHTML closes tags correctly but you don’t get to pick which tags are included.

philecker
# 4
philecker

Thanks Kristen,

I’ve tried to use TruncHTML before, but I need to remove any tags from my excerpts so they display correctly. I wish Brett supported this add-on.

-Phil

Kristen Grote
# 5
Kristen Grote

Hey Phil. You could try CE String: http://www.causingeffect.com/software/expressionengine/ce-string It’s a little over-qualified and requires a little more configuration on your part, but it should get the job done if you’re really desperate for a solution.

UPDATE: Someone on Twitter also recommended combining TruncHTML and Strip HTML.

philecker
# 6
philecker

Thanks again Kristen, you’re right CE String is over qualified but worked PERFECTLY! Great solution. Thanks.

CreateSean
# 7
CreateSean

Bummer - no solution on this? First time I’ve encountered this bug.

Nicolas Bottari - Zenbu Studio
# 8
Nicolas Bottari - Zenbu Studio

Happened to read this thread. If I recall correctly, I think the SuperGeekery Tag Stripper plugin allows to select which tags to remove, as well as closes unclosed tags that might occur after truncating text. That’s the plugin I use. Hope this helps! :)

Philip
# 9
Philip

Hey People - I needed this so I added it to a fork, and submitted a pull request to get it into core.

https://github.com/ZaengleCorp/Hacksaw-for-ExpressionEngine