public function actionIndex() { $criteria = new CDbCriteria(); $pages = new CPagination(Book::model()->count($criteria)); $pages->pageSize = Options::getOption('PostOnPage'); $pages->applyLimit($criteria); $model = Book::model()->findAll($criteria); $books = array(); foreach ($model as $item) { $books[] = Front::getBookAll($item->id); } $this->render('index', ['model' => $books, 'pages' => $pages]); }