I'm attending CakeFest 2010!

{2464} - 7.8.1 Creating an RSS feed with the RssHelper

This example assumes you have a Posts Controller and Post Model already created and want to make an alternative view for RSS.

Creating an xml/rss version of posts/index is a snap with CakePHP 1.2. After a few simple steps you can simply append the desired extension .rss to posts/index making your URL posts/index.rss. Before we jump to far ahead trying to get our webservice up and running we need to do a few things. First parseExtensions needs to be activated, this is done in app/config/routes.php

      Router::parseExtensions('rss');
  1. Router::parseExtensions('rss');

Secondly its a good idea to add RequestHandler to your PostsController's $components array. This will allow a lot of automagic to occur. In the call above we’ve activated the .rss extension. When using Router::parseExtensions() you can pass as many arguments or extensions as you want. This will activate each extension/content-type for use in your application. Now when the address posts/index.rss is requested you will get an xml version of your posts/index. However, first we need to make the view files that will create our rss/xml feed.

{9551} - 7.8.1 Creating an RSS feed with the RssHelper

This example assumes you have a Posts Controller and Post Model already created and want to make an alternative view for RSS.

Creating an xml/rss version of posts/index is a snap with CakePHP 1.2. After a few simple steps you can simply append the desired extension .rss to posts/index making your URL posts/index.rss. Before we jump too far ahead trying to get our webservice up and running we need to do a few things. First parseExtensions needs to be activated, this is done in app/config/routes.php

      Router::parseExtensions('rss');
  1. Router::parseExtensions('rss');

In the call above we’ve activated the .rss extension. When using Router::parseExtensions() you can pass as many arguments or extensions as you want. This will activate each extension/content-type for use in your application. Now when the address posts/index.rss is requested you will get an xml version of your posts/index. However, first we need to edit the controller to add in the rss-specific code.

Differences

Lines: 3-10Lines: 3-12
 <p> <p>
-Creating an xml/rss version of posts/index is a snap with CakePHP 1.2. After a few simple steps you can simply append the desired extension .rss to posts/index making your URL posts/index.rss. Before we jump too far ahead trying to get our webservice up and running we need to do a few things. First parseExtensions needs to be activated, this is done in app/config/routes.php</p> +Creating an xml/rss version of posts/index is a snap with CakePHP 1.2. After a few simple steps you can simply append the desired extension .rss to posts/index making your URL posts/index.rss. Before we jump to far ahead trying to get our webservice up and running we need to do a few things. First parseExtensions needs to be activated, this is done in app/config/routes.php</p>
 <pre> <pre>
  Router::parseExtensions('rss');  Router::parseExtensions('rss');
 </pre> </pre>
 <p> <p>
-In the call above we’ve activated the .rss extension. When using Router::parseExtensions() you can pass as many arguments or extensions as you want. This will activate each extension/content-type for use in your application. Now when the address posts/index.rss is requested you will get an xml version of your posts/index. However, first we need to edit the controller to add in the rss-specific code. +Secondly its a good idea to add RequestHandler to your PostsController's $components array. This will allow a lot of automagic to occur. In the call above we’ve activated the .rss extension. When using Router::parseExtensions() you can pass as many arguments or extensions as you want. This will activate each extension/content-type for use in your application. Now when the address posts/index.rss is requested you will get an xml version of your posts/index. However, first we need to make the view files that will create our rss/xml feed.
 </p> </p>