public function actionView($slug) { $news = News::get($slug); if (!$news) { throw new \yii\web\NotFoundHttpException('News not found.'); } return $this->render('view', ['news' => $news]); }
public function actionView($slug) { $news = News::get($slug); if (!$news) { throw new \yii\web\NotFoundHttpException('News not found.'); } $news_items = News::last_items(3, $news->model->news_id); return $this->render('view', ['news' => $news, 'news_items' => $news_items]); }
public function actionView($slug) { $news = News::get($slug); if (!$news) { throw new \yii\web\NotFoundHttpException('News not found.'); } //return $this->render('view', [ // 'news' => $news //]); return $this->render('index', ['news' => News::items(['pagination' => ['pageSize' => 5]]), 'currentNews' => $news]); }
public function actionNews() { if (!Yii::$app->request->get('slug')) { return $this->render('news', ['slug' => Yii::$app->request->get('slug')]); } $news = News::get(Yii::$app->request->get('slug')); if (!$news) { throw new NotFoundHttpException(); } return $this->render('news-item', ['news' => $news]); }
$this->title = 'ЕШСС - спортивное служение'; ?> <div class="jumbotron"> <?php echo Carousel::widget('1020', '300', ['interval' => 6000]); ?> </div> <h1><?php echo Article::get('home-about')->model->title; ?> </h1> <p> <?php echo News::get('main-page')->text; ?> </p> <div class="row marketing"> <?php foreach (Article::last(2, ['category_id' => 3]) as $item) { ?> <div class="col-lg-6"> <h4><?php echo $item->model->title; ?> </h4>