Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
B_W_P Posted February 19, 2021 Posted February 19, 2021 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. Uber drivers are workers not self-employed, Supreme Court rules <p>The decision could mean thousands of Uber drivers are set to receive minimum wage and holiday pay.</p> High Court urged to overturn PM's decision to stand by Priti Patel <p>Boris Johnson's defence of the home secretary over bullying claims caused "dismay and anger", a union says.</p> Covid vaccine passports could discriminate, experts warn <p>They are 'feasible' but need to meet 12 tests before being brought in, the Royal Society says.</p> 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!
B_W_P Posted February 21, 2021 Author Posted February 21, 2021 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! 🤔
Nathan Explosion Posted February 22, 2021 Posted February 22, 2021 <div>{expression="\IPS\DateTime::ts($item['date'])"}</div> OR <div>{expression="\IPS\DateTime::ts($item['date']->relative())"}</div> B_W_P 1
Stuart Silvester Posted February 22, 2021 Posted February 22, 2021 You need to be extremely careful using |raw especially if the content is coming from an outside source without being cleaned. Incorrect use could open your community to XSS attacks.
Recommended Posts