Automagic RSS Feed Generator Plugin
Automatically create RSS feeds for your CakePHP app.
A .zip of the plugin is available at http://sandbox.siteamonth.com/demo/rss
1. Download FeedCreator 1.7.2-ppt(http://sourceforge.net/projects/feedcreator/) and put the feedcreator.class.php file in /app/vendors/feedcreator.
2. Download the plugin and unzip the contents to app/plugins. The plugin is called "rss", so make sure there is no conflict with any other controllers/plugins
3. Add this to your /app/config/routes.php:
Download code
4. You have to allow permission for the plugin to generate a feed for a particular model. Edit your model to include:
Download code
5. The plugin will attempt to find default values for the feed.
If your model includes a field 'title' or 'name' that will be used automatically for the item title.
The fields 'desc', 'description', 'text', 'content' or 'body' will be used for the item description.
The link will be '/{$model}/view/{$model->primaryKey}' by default.
The results will be ordered by 'created' => 'DESC' by default.
The limit is set to 10 by default.
You can override any of these in the model, as well as set conditions for which rows are returned, by replacing the line used in step #5 with:
Download code
6. You reach the feed using both the singular and plural model name (post or posts).
Download code
Download code
1. Download FeedCreator 1.7.2-ppt(http://sourceforge.net/projects/feedcreator/) and put the feedcreator.class.php file in /app/vendors/feedcreator.
2. Download the plugin and unzip the contents to app/plugins. The plugin is called "rss", so make sure there is no conflict with any other controllers/plugins
3. Add this to your /app/config/routes.php:
Download code
$Route->connect('/rss/*', array('controller' => 'rss', 'action' => 'feed'));
4. You have to allow permission for the plugin to generate a feed for a particular model. Edit your model to include:
Download code
var $feed = true;
5. The plugin will attempt to find default values for the feed.
If your model includes a field 'title' or 'name' that will be used automatically for the item title.
The fields 'desc', 'description', 'text', 'content' or 'body' will be used for the item description.
The link will be '/{$model}/view/{$model->primaryKey}' by default.
The results will be ordered by 'created' => 'DESC' by default.
The limit is set to 10 by default.
You can override any of these in the model, as well as set conditions for which rows are returned, by replacing the line used in step #5 with:
Download code
var $feed = array(
'conditions' => array('Post.active' => true),
'titleField' => 'Post.name',
'descField' => 'Post.desc',
'link' => '/post/view/%s',
'orderby' => array('Post.created' => 'DESC'),
'limit' => 10
);
6. You reach the feed using both the singular and plural model name (post or posts).
Download code
http://yourapp/rss/modelname
orDownload code
http://yourapp/rss/modelnames
Comments
Comment
1 Awesome
Comment
2 The sources are unaccessable
Question
3 how to set encoding
in rss.thtml
$rss = new UniversalFeedCreator();
$rss->encoding = "UTF-8";
it's not work, who can help me? thanks.
Comment
4 dont work in cake1.2
Comment
5 set encoding to UTF 8
default value: var $encoding = "ISO-8859-1";
replace with this:
new value: var $encoding = "UTF-8";
Question
6 how do I get access to this plugin
I just get a controller missing error. Do I need to declare the plugin in the same way that I do with helpers and components?
I tried to get this info from the manual, but 1.1 is vague and 1.2 is vaguer.
Please help as this plugin is just what I'm looking for.
Comment
7 CakePHP 1.2
If you're using Cake 1.2 use the built in RSS support. This helper was really meant for 1.1
-Matt