_archive_item.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @var $model \app\models\News
  4. * @var $key
  5. * @var $index
  6. * @var $widget
  7. */
  8. use app\helpers\Transliterator;
  9. use app\models\base\Image;
  10. $preview = $model->image;
  11. ?>
  12. <div class="">
  13. <div class="archive-news-item" data-key="<?=$key?>">
  14. <div class="illustration">
  15. <?php if($preview instanceof \app\models\base\Image):?>
  16. <div class="picture-cont-16x9">
  17. <a href="<?=$model->url?>">
  18. <picture class="w-100">
  19. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"jpg")?>" media="(min-width: 600px)">
  20. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"webp")?>" media="(min-width: 600px)">
  21. <img src="<?=$preview->getUrl(Image::SIZE_680x383)?>" alt="<?=$model->photo_title?>" class="w-100" loading="lazy">
  22. </picture>
  23. </a>
  24. </div>
  25. <?php else:?>
  26. <div class="picture-cont-16x9">
  27. <a href="<?=$model->url?>">
  28. </a>
  29. </div>
  30. <?php endif;?>
  31. </div>
  32. <div class="meta">
  33. <h2 class="title"><a href="<?=$model->url?>"><?=$model->title?></a></h2>
  34. <div class="published_at">
  35. <?=date("d",strtotime($model->dt_pub))." ".mb_strtolower(Transliterator::month(date("n",strtotime($model->dt_pub)))).date(" Y, H:i", strtotime($model->dt_pub))?>
  36. </div>
  37. </div>
  38. </div>
  39. </div>