/** * Lists all Post models. * @return mixed */ public function actionIndex() { $searchModel = new PostSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->pagination->pageSize = 1; return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Post models. * @return mixed */ public function actionIndex() { $searchModel = new PostSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->sort->defaultOrder = ['is_top' => SORT_DESC, 'post_time' => SORT_DESC, 'update_time' => SORT_DESC]; $dataProvider->pagination->pageSize = 15; return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Post models. * @return mixed */ public function actionIndex() { $searchModel = new PostSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); foreach ($dataProvider->models as $xjj) { Tag::updateFrequency('', $xjj->tags); } return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Post models. * @return mixed */ public function actionIndex() { $searchModel = new PostSearch(); if (empty(Yii::$app->request->getQueryParam('PostSearch'))) { $dataProvider = new ActiveDataProvider(['query' => Post::find()]); } else { $dataProvider = $searchModel->search(Yii::$app->request->queryParams); } return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }
public function actionPosts() { $currentUser = \Yii::$app->user->identity; //当前用户是否是 author if ($currentUser->isAuthor()) { return $this->goHome(); } $params = \Yii::$app->request->queryParams; $params['PostSearch']['user_id'] = $currentUser->id; $postSearch = new PostSearch(); $dataProvider = $postSearch->search($params); }
/** * 网站首页 * 无限加载 * @return string */ public function actionIndex() { //翻页 分类 标签(暂时不做标签) $params = \Yii::$app->request->queryParams; //分类 $condition = array(); if (isset($params['term'])) { $term = Term::findOne(['slug' => $params['term']]); $term ? $params['PostSearch']['term_id'] = $term->id : ''; } $postSearch = new PostSearch(); $dataProvider = $postSearch->search($params, $condition); return $this->render('index', ['postSearch' => $postSearch, 'dataProvider' => $dataProvider]); }
/** * Lists all Post models. * @return mixed */ public function actionIndex() { $searchModel = new PostSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'categoriesList' => $this->getCategoriesList()]); }
/** * Lists all Post models. * @return mixed */ public function actionList() { $searchModel = new PostSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }