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]); }
?> <?php echo Html::a('[Подробно]', ['site/news', 'slug' => $lastNews->slug], ['class' => 'more-link']); ?> </p> </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="col col-9 news-content news-block"> <h2>Свежие новости</h2> <?php foreach (News::items() as $newsItem) { ?> <div> <?php echo Html::a($newsItem->title, ['site/news', 'slug' => $newsItem->slug]); ?> <small>[<?php echo date('Y-m-d', $newsItem->time); ?> ]</small> </div> <?php } ?>
<?php if (count($news->photos)) { ?> <div> <h4>Photos</h4> <?php foreach ($news->photos as $photo) { ?> <?php echo $photo->box(100, 100); ?> <?php } ?> <?php News::plugin(); ?> </div> <br/> <?php } ?> <p> <?php foreach ($news->tags as $tag) { ?> <a href="<?php echo Url::to(['/news', 'tag' => $tag]); ?> " class="label label-info"><?php echo $tag;
Gallery::plugin(); ?> </div> <br/> <hr/> <div class="text-center"> <h2>Last news</h2> <blockquote class="text-left"> <?php echo Html::a(News::last()->title, ['news/view', 'slug' => News::last()->slug]); ?> <br/> <?php echo News::last()->short; ?> </blockquote> </div> <br/> <hr/> <div class="text-center"> <h2>Last article from category #1</h2> <br/> <div class="row text-left"> <?php $article = Article::last(1, ['category_id' => 1]); ?>
$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>
</p>--> <p> <?php foreach ($item->tags as $tag) { ?> <a href="<?php echo Url::to(['/news', 'tag' => $tag]); ?> " class="label label-info"><?php echo $tag; ?> </a> <?php } ?> </p> </div> </div> <br> <?php } ?> <?php echo News::pages(); ?> </div> </div> </div>
</div> </div> </div> <div class="container"> <div class="row"> <div class="col col-4"> <div class="block-head"> <h3>Корпоративные новости</h3> <span class="eng-title">Corporate Information</span> <a href="/">посмотреть все >></a> </div> <div class="news"> <ul> <?php foreach (News::last(5) as $news) { ?> <li> <span class="icon">●</span> <a class="title" href="<?php echo Yii::$app->urlManager->createUrl(['site/news', 'slug' => $news->slug]); ?> "><?php echo $news->title; ?> </a> <span class="date">[<?php echo $news->date; ?> ]</span> </li>
Gallery::plugin(); ?> </div> <br/> <hr/> <div class="text-center"> <h2>Последние новости</h2> <blockquote class="text-left"> <?php echo News::last() ? Html::a(News::last()->title, ['news/view', 'slug' => News::last()->slug]) : ""; ?> <br/> <?php echo News::last() ? News::last()->short : ""; ?> </blockquote> </div> <br/> <hr/> <div class="text-center"> <h2>Последние статьи</h2> <br/> <div class="row text-left"> <?php $article = Article::last(1, ['category_id' => 1]); ?>