コード例 #1
0
ファイル: NewsController.php プロジェクト: MaoCzedun/AdCoin
 public function actionView($slug)
 {
     $news = News::get($slug);
     if (!$news) {
         throw new \yii\web\NotFoundHttpException('News not found.');
     }
     return $this->render('view', ['news' => $news]);
 }
コード例 #2
0
 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]);
 }
コード例 #3
0
 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]);
 }
コード例 #4
0
ファイル: SiteController.php プロジェクト: egor-pisarev/merro
 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]);
 }
コード例 #5
0
ファイル: index.php プロジェクト: Bazitron/easls
$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>