コード例 #1
0
 public function actionShow($url)
 {
     $request = Yii::$app->request;
     $contentId = $request->post('contentId');
     if ($url == 'all') {
         $category_info = ['name' => Yii::t('yii', 'Все статьи'), 'url' => 'all'];
         $articles = Blog::getAllBlog(20, 'all', $contentId);
     } else {
         $category_info = Blog::CategoryInfo($url);
         $articles = Blog::getAllBlog(20, $category_info['id'], $contentId);
     }
     if ($request->isAjax) {
         echo json_encode(['content' => $articles]);
         return;
     }
     $categories = Category::getAllCategory();
     $marks = Marks::getArticleMarks(20);
     return $this->render('show', ['articles' => $articles, 'categories' => $categories, 'marks' => $marks, 'category_info' => $category_info]);
 }