123456789101112131415161718192021 |
- <?php
- if(Yii::$app->deviceDetect->isMobile()) return "";
- $query = \app\models\base\Comments::find()->andWhere(['visible'=>'Y'])->orderBy(['created_at'=>SORT_DESC])->limit(3);
- $view = $this;
- ?>
- <div class="header-center__comments">
- <div class="header-comments">
- <div class="header-comments__wrapper"><h2 class="header-comments__title">Комментарии в эфире</h2>
- <?= Yii::$app->cache->getOrSet("header-comments",function () use ($query,$view){
- $comments= \yii\helpers\Html::beginTag("ul",["class"=>"header-comments__list"]);
- foreach ($query->all() as $model)
- {
- $comments.= $view->render('_header_comments_item',['model'=>$model]);
- }
- $comments.= \yii\helpers\Html::endTag("ul");
- return $comments;
- },60);
- ?>
- </div>
- </div>
- </div>
|