123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * @var $model \app\models\News
- * @var $key
- * @var $index
- * @var $widget
- */
- use app\models\base\Image;
- $preview = $model->preview;
- switch ($index){
- case 0:
- $className = "main";
- break;
- case 1:
- $className = "high";
- break;
- default:
- $className = "low";
- }
- if($index==2) echo \yii\helpers\Html::beginTag("div",["class"=>'group']);
- ?>
- <div class="news-item <?=$className?>" data-key="<?=$key?>">
- <?php if($preview instanceof Image && $index==0):?>
- <div class="picture-cont-16x9">
- <a href="<?=$model->url?>">
- <picture class="w-100">
- <source srcset="<?=$preview->getUrl(Image::SIZE_680x383)?>" media="(min-width: 600px)">
- <img src="<?=$preview->getUrl(Image::SIZE_680x383)?>" alt="<?=$model->photo_title?>" class="w-100" loading="lazy">
- </picture>
- </a>
- </div>
- <?php endif;?>
- <div class="meta">
- <h2 class="title"><a href="<?=$model->url?>"><?=$model->title?></a></h2>
- <?php if($className!="low"): ?><div class="lead"><?=$model->lid?></div><?php endif;?>
- <div class="published_at">
- <?=$model->publishedAt?>
- <?php
- $count=$model->getCommentsAll()->count();
- ?>
- <?php if($count>0):?>
- <span class="commnets"> <svg class="icon icon-comments"><use xlink:href="/svg/symbol/sprite-clear.svg#comments"></use></svg><?=$count?></span>
- <?php endif;?>
- </div>
- </div>
- </div>
- <?php
- if($index==3) echo \yii\helpers\Html::endTag("div");
- ?>
|