예제 #1
0
 public function actionTopic()
 {
     static $topics = ['today', 'hot'];
     $topic = \Yii::$app->request->get('topic');
     $p = \Yii::$app->request->get('p', 1);
     if (in_array($topic, $topics)) {
         switch ($topic) {
             case 'hot':
                 $title = '热门推荐';
                 $list = Blog::hotList();
                 break;
             default:
                 break;
         }
     } else {
         if (is_numeric($topic)) {
             $cid = intval($topic);
             $list = Blog::getListByCid($cid);
             $title = Category::getName($cid);
         }
     }
     $this->getView()->params['title'] = $title;
     $this->getView()->params['description'] = $title;
     return $this->render('/site/list', ['data' => $list]);
 }