Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

remove HTML tags from RSS


Go to End


1736 Views

Avatar
Anatol

126 Posts

3 September 2008 at 12:43pm

Hi,

I am using the blog module with TinyMCE rich text editor. Is there any way to remove the HTML tags that I use in blog posts from the RSS output? I use embedded video in some blog posts but both the embed and object tag are no valid elements for RSS. I have problems to load the feed into another page.

I tried strip_tags() in various places - even in the sapphire RSSFeed class - but nothing seems to work. Ideally I would not like to touch sapphire for this.

This is a sample of my modified RSS generating code in BlogHolder.php:

function rss() {
		global $project;
		$rss = new RSSFeed($this->LatestEntries(), $this->Link(), "MyDomain - 10 most recent blog entries", "Show the 10 most recent blog entries.", "Title", "Content");
		$rss->outputToBrowser();
	}
	
	function LatestEntries() {
		// return the latest 10 blog articles
		return DataObject::get("BlogEntry", "", "`SiteTree_Live`.ID DESC", "", 10);
	}

Any help or suggestion is appreciated.

Cheers!
Anatol