Hello. In action, there is a trace. code:

$criteria = new CDbCriteria; $criteria->with=array( 'rel1', 'rel2'=>array( 'condition'=>'type_id =:id', 'params'=>array(':id'=>$id), 'together'=>true, ), ); $criteria->distinct = true; $count = MyModel::model()->count($criteria); $pages=new CPagination($count); $pages->pageSize=9; $pages->applyLimit($criteria); $model= MyModel::model()->findAll($criteria); $this->render('view',array( 'model'=>$model, 'pages'=>$pages, )); 

Then I display the data in a normal cycle in the view and display the pagination itself through CLinkPager.

Problem: Instead of displaying nine entries on each page, the pagination outputs a total of 9 entries and splits them into pages without a trace. The request to the database itself works correctly, gets the necessary entries in the right amount. The problem begins when I cling CPagination.

How to solve this problem, what am I doing wrong?

    1 answer 1

    Try closing the CActiveDataProvider and display via zii.widgets.CListView. Do not loop the data yourself, this is bad!