Posted Apr 20, 2014 · Updated May 3, 2014

Edit controllers/SiteController.php and add the following lines:

public function actionRss() {
	$posts=Post::model()->findAll(array(
		'order'=>'create_time DESC',
		'condition'=>'status='.Post::STATUS_PUBLISHED,
		'limit'=>20,
	));

	header('Content-Type: application/xml');
	$this->renderPartial('rss', array('posts'=>$posts));
}
Posted Apr 22, 2014

Edit controllers/PostController.php and add this to the function actionIndex:

if(isset($_GET['search']))
	$criteria->addSearchCondition('title',$_GET['search'], true, 'AND');
	$criteria->addSearchCondition('content',$_GET['search'], true, 'OR');

Create components/Search.php with the following content:

<?php
Yii::import('zii.widgets.CPortlet');

class Search extends CPortlet
{
	public $title='Search';

	protected function renderContent()
	{
		echo CHtml::form(Yii::app()->createUrl('post/index'), 'get');
		echo CHtml::textField('search', $_GET['search'],
			array('placeholder'=>'keyword...', 'size'=>20));
		echo CHtml::submitButton('OK');
		echo CHtml::endForm();
	}
}

Now add this line to views/layouts/column2.php and you are all set!

<?php $this->widget('Search'); ?>