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

RSS Feed Show First Paragraph Only?


Go to End


2 Posts   2498 Views

Avatar
3dkiwi

Community Member, 18 Posts

7 April 2008 at 11:39am

Guys

I am implementing the RSS Feed as per the tutorial stage II but with some of my own modifications. eg. changing the DataObject::get to get the last 20 edited pages of a particular page type: DataObject::get("TipPage", "", "LastEdited DESC", "", "20"); This is working well.

However I would like to only show the first paragraph of each of the returned page in the RSS. I know there is a function on the $Content within the Newsletter stuff which I have used for that part of the website but do not see any similar function for the RSS Feed.

Any hints, please...

3d

Avatar
socks

Community Member, 191 Posts

26 October 2008 at 5:38pm

Edited: 26/10/2008 5:38pm

I need to do this as well. Currently my RSS feed is showing the entire article (Content), and I haven't been able to figure out how to truncate it in the feed.

This is how I'm generating the feed...

// RSS
		function init() {
			RSSFeed::linkToFeed($this->Link() . "rss");
			parent::init();
		}

		function rss() {
			$rss = new RSSFeed($this->LatestUpdates(), $this->Link(), "A Word From Steve", "", "Title", "Content");
			$rss->outputToBrowser();
		}

		function LatestUpdates() {
			// 5 is the number of items listed
			return DataObject::get("StevesArticlesPage", "", "Created Desc", "", 5);
		}

Any suggestions?

Thanks,
Clint