_partner_news_item.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * @var $model \app\models\News
  4. * @var $key
  5. * @var $index
  6. * @var $widget
  7. */
  8. use app\models\base\Image;
  9. $preview = $model->image;
  10. ?>
  11. <div class="col-md-4">
  12. <div class="partner-news-item " data-key="<?=$key?>">
  13. <a href="<?=$model->url?>">
  14. <?php if($preview instanceof \app\models\base\Image):?>
  15. <div class="picture-cont-16x9">
  16. <picture class="w-100">
  17. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"jpg")?>?v=<?=$model->rev?>" media="(min-width: 600px)">
  18. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"webp")?>?v=<?=$model->rev?>" media="(min-width: 600px)">
  19. <img src="<?=$preview->getUrl(Image::SIZE_680x383)?>?v=<?=$model->rev?>" alt="<?=htmlentities($model->photo_title,ENT_QUOTES)?>" class="w-100" loading="lazy">
  20. </picture>
  21. </div>
  22. <?php endif;?>
  23. <div class="meta">
  24. <h2 class="title"><?=$model->title?></h2>
  25. <div class="published_at">
  26. <?=$model->publishedAt?>
  27. <?php
  28. $count=$model->getCommentsAll()->count();
  29. ?>
  30. <?php if($count>0):?>
  31. <span class="commnets">&nbsp;<svg class="icon icon-comments"><use xlink:href="/svg/symbol/sprite-clear.svg#comments"></use></svg><?=$count?></span>
  32. <?php endif;?>
  33. </div>
  34. </div>
  35. </a>
  36. </div>
  37. </div>