Yii Framework的CPagination用法详解

阅读更多
Yii Framework的CPagination用法详解
controller代码:

    public function actionIndex()
    {
    $model=new Gallery();
    $criteria=new CDbCriteria;
    $total = $model->count($criteria);
    $pages=new CPagination($total);
    $pages->pageSize=self::PAGE_SIZE;
    $pages->applyLimit($criteria);
    $list = $model->findAll($criteria);
    $this->render('index',array(
        'list'=>$list,
        'pages'=>$pages,
        ));
    }

复制代码
view代码:

   
   

  •     title,array('gallery/view','id'=>$data->id));?>
       

  •    

    你可能感兴趣的:(PHP)