123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>\app\models\base\Comments::find()->andWhere(['need_moderation'=>0])
- ->leftJoin(["p"=>\app\models\base\OldNews::tableName()],'p.comment_pull_id = comments.comment_pull_id')
- ->andWhere(['is not','p.id',new \yii\db\Expression('NULL')])
- ->orderBy(['id'=>SORT_DESC]),
- "pagination" =>[
- "pageSize"=>3
- ],
- ]
- );
- ?>
- <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 ($newsDataProvider){
- $sql = $newsDataProvider->query->createCommand()->getRawSql();
- return \yii\widgets\ListView::widget([
- "dataProvider" => $newsDataProvider,
- 'options' => [
- 'tag' => "ul",
- 'class' => 'header-comments__list',
- 'id' => false,
- ],
- "itemOptions"=>[
- "tag"=>false
- ],
- "itemView" => "_header_comments_item",
- "layout" => "{items}"
- ]);
- },1);
- ?>
- </div>
- </div>
- </div>
|