0

In the bootstrap file of each of my modules I am populating my Zend_Navigation instance so that I can create html/xml sitemaps, side-bar navigation, admin navigation and, now, I want to create an rss feed.

Instead of duplicating code and adding the pages to Zend_Feed, is there a way to use Zend_Navigation to populate Zend_Feed?

Richard Parnaby-King
  • 14,703
  • 11
  • 69
  • 129

2 Answers2

0

Feeds are linear entries and do not support nested structures like Navigation.

However, Navigation Containers implement SPL Iterator Interfaces, so you can easily iterate them via foreach to pass the pages as feed entries.

But I think the better approach would be to add new feed entries when you add your pages to navigation containers, the same way.

takeshin
  • 49,108
  • 32
  • 120
  • 164
  • I'm not really interested in the navigation structure, I just want to pop all my pages from Navigation into an rss feed. Anticipating this answer, though, I extended Zend_View_Helper_Navigation (instead of Zend_Navigation because I was in a hurry and not looking at what I was doing) to take the nav, create an array of items that Zend_Feed would accept, and returned the array. – Richard Parnaby-King Jan 28 '11 at 09:25
0

I extended Zend_View_Helper_Navigation to take the nav, create an array ($feed) of items that Zend_Feed would accept, and returned Zend_Feed::importBuilder(new Zend_Feed_Builder($feed), 'rss')->saveXML();

Richard Parnaby-King
  • 14,703
  • 11
  • 69
  • 129