where(['<>', 'title', ''])->where([ 'active'=>1]); $pages = new \yii\data\Pagination(['totalCount' => $news_query->count(), 'pageSize'=>50]); $gets = \Yii::$app->request->get(); $valid_get = array_filter($gets, function($k) { $valid = ['page'=>true, 'per-page'=>false]; return isset( $valid[$k] ); }, ARRAY_FILTER_USE_KEY); $pages->pageSizeParam = false; // $pages->params = $valid_get; $pages->route = \Yii::$app->urlManager->createUrl(['photo']); $dataProvider = new ActiveDataProvider([ 'query' => $news_query, 'pagination' => $pages, 'sort' => [ 'defaultOrder' => [ 'id' => SORT_DESC, ] ], ]); return $this->render('index', [ 'dataProvider' => $dataProvider, ]); } public function actionView($topic){ if( is_numeric($topic) ){ $model = ReportTopic::findOne(['id'=>$topic]); if( ( !$model instanceof ReportTopic ) || $model->active == 0 ){ throw new NotFoundHttpException("Стр. не найдена"); } return $this->render("view",["model"=>$model]); } throw new NotFoundHttpException("Стр. не найдена"); } public function actionWidget($topic){ if( is_numeric($topic) ){ $model = ReportTopic::findOne(['id'=>$topic]); if( ( !$model instanceof ReportTopic ) ){ throw new NotFoundHttpException("Стр. не найдена"); } return $this->renderPartial("widget",["model"=>$model]); } throw new NotFoundHttpException("Стр. не найдена"); } }