Example #1
0
 public function actionDetail($id)
 {
     if (!empty($id)) {
         $new = News::findOne($id);
         $user_exp = TUser::find()->select('name,level')->orderBy('totalexp DESC')->limit(9)->all();
         return $this->render('detail', ['new' => $new, 'users' => $user_exp]);
     }
 }
Example #2
0
 public function actionIndex()
 {
     $news = News::find()->andWhere(['status' => 1]);
     $pages = new Pagination(['totalCount' => $news->count(), 'defaultPageSize' => 5]);
     $models = $news->offset($pages->offset)->limit($pages->limit)->all();
     $user_exp = TUser::find()->select('name,level')->orderBy('totalexp DESC')->limit(9)->all();
     return $this->render('index', ['models' => $models, 'pages' => $pages, 'users' => $user_exp]);
 }