ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Use two plugins on the same content?

May 10, 2011 6:45pm

Subscribe [3]
  • #1 / May 10, 2011 6:45pm

    rubberglover

    11 posts

    Hi,

    This is probably an easy fix, but I’m currently stumped…

    I am using the truncHTML plugin to truncate content whilst retaining HTML. The thing is, I want to retain most of the HTML but to strip out certain tags. For example, I want the truncated text to retain links and strong tags, but I want to remove paragraph tags.

    I’ve been using Ingo Wedler’s Strip_HTML plugin, which allows me to remove all HTML tags whilst except the ones I specify. I want to use a combination of these plugins on the same dynamic content, but if I nest one tag pair inside another it’s not happy!

    The html_strip code looks like this:

    {exp:strip_html keep='b|em|strong|a'}
    
        {article_body}
    
    {/exp:strip_html}

    The trunchtml code looks like…

    {exp:trunchtml chars="440" inline="..." ending="<p class='read_more'><a href=''>Read full article</a></p>"}
    
        {article_body}
    
    {/exp:trunchtml}

    I was wondering if there was an easy way to process the content with one plugin, assign it to a new variable, then format that variable with the second plugin? Any advice?

    (I’m using EE 2.1.3)

  • #2 / May 10, 2011 8:18pm

    rubberglover

    11 posts

    Ignore the above… it does work when you nest them, I had an error in my syntax. Here’s how it ended up looking in case anyone else wants to do this:

    {exp:trunchtml chars="440" inline="..." ending="<p class='read_more'><a href=''>Read full article</a></p>"}
        {exp:strip_html keep='b,em,strong,a'}
            {article_body}
        {/exp:strip_html}
    {/exp:trunchtml}
  • #3 / May 10, 2011 8:23pm

    Natetronn

    161 posts

    I don’t know if you can do it with TruncHTML or not, you will have to ask the dev. Maybe have a look at Hacksaw in the meantime.

  • #4 / May 10, 2011 8:24pm

    Natetronn

    161 posts

    Glad you figured it out!  😊

  • #5 / May 11, 2011 6:12am

    John Henry Donovan

    12339 posts

    Good stuff 😊 Closing this one out. Feel free to start a new thread if you have any more questions

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases