_archive_item.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?
  2. use yii\helpers\Html;
  3. $imgFileShort = "/images/report_photo/";
  4. // echo '<div class="attachment-block clearfix" style="max-width: 92px;"><img src="'.$imgFileShort.$model->folder.'/0.160.jpg'.'" width="80px" class="attachment-img"></div>';
  5. // echo Html::a(Html::encode(strip_tags($model->title)), $model->getUrl());
  6. $img = $imgFileShort.$model->folder.'/0.160.jpg';
  7. $imgFileShort = "/images/report_photo/{$model->folder}/";
  8. $amic_image = $imgFileShort."0.size2.jpg";
  9. if( file_exists(Yii::getAlias('@webroot').$amic_image) ){
  10. $img = $amic_image;
  11. }
  12. if( isset($index) ){
  13. $index = $index+1;
  14. }else{
  15. static $index = 0;
  16. }
  17. $key = $index;
  18. ?>
  19. <div class="">
  20. <div class="archive-news-item" data-key="<?=$key?>">
  21. <div class="illustration">
  22. <div class="picture-cont-16x9">
  23. <a href="<?=$model->getUrl()?>">
  24. <picture class="w-100">
  25. <img src="<?=$img?>" alt="<?=htmlentities(strip_tags($model->title),ENT_QUOTES)?>" class="w-100" <?=($index > 2)?'loading="lazy"':''?>>
  26. </picture>
  27. </a>
  28. </div>
  29. </div>
  30. <div class="meta">
  31. <h2 class="title"><a href="<?=$model->getUrl()?>"><?=strip_tags($model->title)?></a></h2>
  32. <div class="published_at">
  33. <?=$model->date?>
  34. </div>
  35. </div>
  36. </div>
  37. </div>