Example #1
0
 public function actionType($id)
 {
     $type = Type::findOne($id);
     $news = new News();
     $popular = $news->popularfromType($id, 10, 0);
     $data = $news->find()->where(['status' => M::status_enable])->andWhere(['type_id' => $id])->orderBy(['id' => SORT_DESC])->limit(20)->offset($this->paging(20))->all();
     return $this->render('itemtype', ['type' => $type, 'data' => $data, 'news' => $news->newsfromType($id, 5), 'news2' => $news->newsfromType($id, 4, 5), 'popular' => $popular]);
 }