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.

Character Limiting RSS {description} causing validation errors

August 20, 2007 10:04pm

Subscribe [2]
  • #1 / Aug 20, 2007 10:04pm

    hothousegraphix

    851 posts

    I’ve established an ordered list to which I display an RSS feed: e.g.

    <ol>
    {exp:magpie url="http://chronicle.com/wiredcampus/rss/" limit="3" refresh="720" parse="inward"}
    {items}
    <li class="newsItem">
    <h3><a href="http://{link}">{exp:char_limit total="50"}{title}{/exp:char_limit}</a></h3>
    <p>{exp:char_limit total="100"}{description}{/exp:char_limit}<br />
    </li><br />
    {/items}<br />
    {/exp:magpie}   <br />
    </ol>

    This all works fine with one little issue.

    If feed {description} extends beyond 100 characters, the closing tag included in the feed is eliminated. The simple fix is to add a closing tag after the

    ...{/exp:char_limit} //as such

    The trouble with the above solution is that if the feed description ends up shorter then 100 characters and it includes the closing tag my simple fix causes another unmatched tag validation error by including this extra closing tag.

    Has anyone come up with a work around? Some sort of conditional that looks for the tag in the {description} and if not found, writes the closing tag?

    I hope this all makes sense.

    Thanks

  • #2 / Aug 20, 2007 10:25pm

    Sue Crocker

    26054 posts

    Take a look at this plugin: Trunchtml

    See if that helps.

  • #3 / Aug 21, 2007 12:19am

    hothousegraphix

    851 posts

    Sue, thank you very much!  😊

    This is exactly what I need.

    For those who have stumbled on this thread, please note that you cannot set your magpie tag to parse=“inward”. Doing so causes the Trunchtml plugin to function improperly.

    Thanks Sue.

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

ExpressionEngine News!

#eecms, #events, #releases