Jump to content

Strip html tags from parsed RSS


B_W_P

Recommended Posts

Hi all, I'm struggling to find a way to prevent/remove the <p> tags from text produced by the RSS Import block

The following code in the 'content' section of the block...

{{if !empty( $items ) }}
<ul>
{{foreach $items as $item}}
	<li>
		<div class="link"><a href="{$item['link']}" target="_blank"><h3>{$item['title']}</h3></a></div>
		<div>{$item['content']}</div>
	</li>
{{endforeach}}
</ul>
{{endif}}

....produces text with a paragraph <p> around the content, e.g.

 
 
The <p> tag isn't in the original RSS feeds, and I've tried many feeds, so it's being introduced by the block. The above text was parsed from http://feeds.bbci.co.uk/news/rss.xml
 
Do any of you know how I can prevent the tag being added, or strip the tag from the results?
 
Thanks!
 
Link to comment
Share on other sites

Thanks a million @Nathan Explosion! That worked perfectly

My next quest is to figure out how to turn the 10 digit date string the IPS block is parsing from the RSS feed into a human readable format, for example:

The RSS feed says "Sun, 21 Feb 2021 19:35:59 GMT" but the block is pulling out....

["date"]=> int(1613939402)

and it just shows the last time the feed was updated when the following default code in the block is used

{datetime="$item['date']"

I'm assuming it'll be something simple I'm missing! 🤔

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...