This post covers my notes on Adding an RSS Web Feed (chapter 9) in Yii from the book "Web Application Development with Yii and PHP" by Jeffrey Winesett about learning Yii by taking a step-by-step approach to building a Web-based project task tracking system from conception through production deployment - software development life cycle (SDLC) issue-management application.

Feature planning

  • Use Zend Framework in the Yii application
  • Creating a new action in a controller class to respond to the feed request and return the appropriate data in an RSS format
  • Altering our URL structure for ease of use
  • Adding our newly created feed to both the project listings page as well as to each individual project details page
     * Uses Zend Feed to return an RSS formatted comments data feed
    public function actionFeed()
            $comments = Comment::model()->with(array(
            $comments = Comment::model()->recent(20)->findAll();  
        //convert from an array of comment AR class instances to an name=>value array for Zend
        foreach($comments as $comment)
                    'description'=> $comment->author->username . ' says:<br>' . $comment->content,
        //now use the Zend Feed class to generate the Feed
        // generate and render RSS feed
             'title'   => 'Trackstar Project Comments Feed',
             'link'    => $this->createAbsoluteUrl(''),
             'charset' => 'UTF-8',
             'entries' => $entries,      
         ), 'rss');
/*ProjectController::actionIndex() method.
Alter that method as follows:*/
public function actionIndex()
$dataProvider=new CActiveDataProvider ('Project');
/*similar change to add this link to a specific project details page. The rendering of these pages is handled by the ProjectController::actionView() method.*/
     * Displays a particular model.
     * @param integer $id the ID of the model to be displayed
    public function actionView($id)
        $issueDataProvider=new CActiveDataProvider('Issue', array(

Download source code of chapter 9

Chapter 10 covers: Adding Layout (looking good)

Download source code of chapter 10

Chapter 11 covers: Using Yii Modules

Download source code of chapter 11

Chapter 12 covers: Production Readiness

Download source code of chapter 12

Leave a Comment

Fields with * are required.

Please enter the letters as they are shown in the image above.
Letters are not case-sensitive.