悲伤de柠檬 2011-09-13 09:21:27 3235次浏览 5条回复 0 0 0
public function actionIndex()
{
    $criteria=new CDbCriteria(array(
        'condition'=>'status='.Post::STATUS_PUBLISHED,
        'order'=>'update_time DESC',
        'with'=>'commentCount',
    ));
    if(isset($_GET['tag']))
        $criteria->addSearchCondition('tags',$_GET['tag']);

    $dataProvider=new CActiveDataProvider('Post', array(
        'pagination'=>array(
            'pageSize'=>Yii::app()->params['postsPerPage'],
        ),
        'criteria'=>$criteria,
    ));

    $this->render('index',array(
        'dataProvider'=>$dataProvider,
    ));
}

有人能帮我详细讲下吗

您需要登录后才可以回复。登录 | 立即注册