_archive_item.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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?>">
  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?>">
  27. </a>
  28. </div>
  29. <?php endif;?>
  30. </div>
  31. <div class="meta">
  32. <h2 class="title"><a href="<?=$model->url?>"><?=$model->title?></a></h2>
  33. <div class="published_at">
  34. <?=$model->publishedAt?> <?=date("Y, H:m")?>
  35. </div>
  36. </div>
  37. </div>
  38. </div>