=$news->title?>
+=$news->date?>
+diff --git a/frontend/controllers/ArticlesController.php b/frontend/controllers/ArticlesController.php new file mode 100755 index 0000000..c6645bf --- /dev/null +++ b/frontend/controllers/ArticlesController.php @@ -0,0 +1,42 @@ +groupBy('id')->orderBy('id DESC') ; + $countQuery = clone $query; + $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize'=>18]); + $pages->forcePageParam = false; + $pages->pageSizeParam = false; + $news = $query->offset($pages->offset) + ->with(['comments.rating', 'averageRating']) + ->limit($pages->limit) + ->all(); + + return $this->render('index', [ + 'pages'=>$pages, + 'news'=>$news, + ]); + } + + public function actionShow(){ + if(!$news = Articles::find()->where(['id'=>$_GET['id']])->one()) + throw new HttpException(404, 'Данной странице не существует!'); + + return $this->render('show', [ + 'news'=>$news, + ]); + } + +} \ No newline at end of file diff --git a/frontend/views/articles/index.php b/frontend/views/articles/index.php new file mode 100755 index 0000000..5c24f5d --- /dev/null +++ b/frontend/views/articles/index.php @@ -0,0 +1,78 @@ +getModule('artbox-comment'); + CommentAsset::register($this); +?> +title = 'Блог'; + + + + $this->params['breadcrumbs'][] = $this->title; + + $this->registerMetaTag([ + 'name' => 'description', + 'content' => 'Блог', + ]); + $this->registerMetaTag([ + 'name' => 'keywords', + 'content' => 'Блог', + ]); +?> + + +
=$news->date?>
+
+ comments); + echo Html::a(( $comment_count ? 'Отзывов: ' . count($item->comments) : "Оставить отзыв" ), [ + 'articles/show', + 'translit' => $item->translit, + 'id' => $item->id, + '#' => 'artbox-comment', + ]); + ?> +
+