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.

Blog Module /

Discuss the Blog Module.

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

RSSFeed: Can you subscribe to Children OF Children?


Go to End


3 Posts   1522 Views

Avatar
Garrett

Community Member, 245 Posts

6 October 2009 at 2:44am

Hi,

I've got a Newsroom which has several content types, i.e.: Press Releases, the Blog, Events, etc. I'd like to offer an RSS feed on this parent level, but I noticed that the RSS Feed class constructor only takes $this->Children as a parameter. I'd like it to build the XML going another level down if possible. I tried passing in:

$rss = new RSSFeed($this->Children()->Children, $this->Link(), "Newsroom");

But alas it does not appear that Children() can be called recursively. Can anyone suggest a way to do this?

Thanks in advance,
Garrett

Avatar
dio5

Community Member, 501 Posts

13 October 2009 at 2:38am

The first argument for the RSSFeed method needs a DataObjectSet, like you could get with Children(). Calling Children() on that does not make much sense I think, because you can call that only on one item, not on an entire set.

Not sure what you're trying to achieve: you want multiple rss feeds or one that combines all of them?

If you want 'all' of them in one, you could just do a DataObject::get("YourPageType", "WHERE", "SORTBY") and take that as the argument for the RSSFeed method.

Hope this makes some sense. :)

Avatar
Garrett

Community Member, 245 Posts

13 October 2009 at 3:04am

That's a really good idea-- thanks @dio5! I will do exactly that.

//Garrett