_archive_item.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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="">
  12. <div class="archive-news-item" data-key="<?=$key?>">
  13. <div class="illustration">
  14. <?php if($preview instanceof \app\models\base\Image):?>
  15. <div class="picture-cont-16x9">
  16. <a href="<?=$model->url?>" target="_blank">
  17. <picture class="w-100">
  18. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"jpg")?>" media="(min-width: 600px)">
  19. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"webp")?>" media="(min-width: 600px)">
  20. <img src="<?=$preview->getUrl(Image::SIZE_680x383)?>" alt="<?=$model->photo_title?>" class="w-100" loading="lazy">
  21. </picture>
  22. </a>
  23. </div>
  24. <?php else:?>
  25. <div class="picture-cont-16x9">
  26. <a href="<?=$model->url?>" target="_blank">
  27. </a>
  28. </div>
  29. <?php endif;?>
  30. </div>
  31. <div class="meta">
  32. <h2 class="title"><a href="<?=$model->url?>" target="_blank"><?=$model->title?></a></h2>
  33. <div class="published_at">
  34. <?=$model->publishedAt?> <?=date("Y, H:m")?>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. <?php if($index == 4) echo $this->render("@app/views/_etc/banners/archiveAfterFive")?>