Trooper Posted January 23, 2008 Share Posted January 23, 2008 I can't figure out how to build an RSS feed using Zend_Feed. This is my code, but it gives me an error where the entries => $posts saying that posts is undefined. Also, FireFox just downloads it as if it were a file...its not viewing it as an rss feed. Possibly cause of this error. Any help would be great! /* RSS Action * This generates an RSS feed from the posts */ public function rssAction() { $db = Zend_Registry::get( 'db' ); $postresult = $db->fetchAll( 'SELECT * FROM posts WHERE post_published=1 ORDER BY post_date DESC' ); for( $i = 0; $i == count( $postresult ); $i++ ) { $posts[$i][] = array ( 'title' => $postresult[$i]['post_headline'], 'link' => 'http://192.168.0.25/index/post/id/' . $postresult[$i]['post_id'], 'description' => substr( $postresult[$i]['post_copy'], 0, 100 ), 'content' => $postresult[$i]['post_copy'], 'lastUpdate' => $postresult[$i]['post_date'] ); } $feeddata = array ( 'title' => 'Ryan\'s Blog', 'description' => 'My personal blog about what ever is on my mind...usually technology related.', 'link' => 'http://192.168.0.25', 'author' => 'Ryan', 'email' => 'trooper@spamex.com', 'charset' => 'UTF-8', 'copyright' => 'Copyright © 2008 Ryan Capote', 'entries' => $posts ); $feed = Zend_Feed::importArray( $feeddata, 'rss' ); $feed->saveXML(); $feed->send(); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.