wide_widget_video.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @var $post \app\models\News
  4. * @var \yii\data\ActiveDataProvider $newsDataProvider
  5. * @var \app\models\base\NewsTopic | \app\models\base\Story $topic
  6. * @var \app\models\Design $design
  7. */
  8. use app\models\base\Image;
  9. //if( YII_ENV != 'dev' ) return;
  10. if( $topic instanceof \app\models\base\NewsTopic ) $url = '/news/';
  11. if( $topic instanceof \app\models\base\Story ) $url = '/story/';
  12. if( $topic instanceof \app\models\base\Tags ) $url = '/tags/';
  13. try{
  14. $post = Yii::$app->cache->getOrSet("main-page-wide-video-".$design->id,function () use($newsDataProvider){
  15. return $newsDataProvider->models[0];
  16. },600);
  17. $model = $post;
  18. $preview = $model->image;
  19. $key = 'okey';
  20. ?>
  21. <div class="row partner-news" style="height-min:360px">
  22. <div class="col-md-8">
  23. <div class="cont">
  24. <iframe width="100%" height="100%" style="aspect-ratio: 16 / 9;" src="https://www.youtube.com/embed/5FNI26lPfgE?autoplay=1" title="Crystal Bay Yacht Club | Lamai | Koh Samui | Thailand | Live Beach Webcam | 2160p 4K" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
  25. </div>
  26. </div>
  27. <div class="col-md-4" >
  28. <div class="partner-news-item " data-key="<?=$key?>">
  29. <a href="<?=$model->url?>">
  30. <?php if($preview instanceof \app\models\base\Image):?>
  31. <div class="picture-cont-16x9">
  32. <picture class="w-100">
  33. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"jpg")?>?v=<?=$model->rev?>" media="(min-width: 600px)">
  34. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"webp")?>?v=<?=$model->rev?>" media="(min-width: 600px)">
  35. <img src="<?=$preview->getUrl(Image::SIZE_680x383)?>?v=<?=$model->rev?>" alt="<?=htmlentities($model->photo_title,ENT_QUOTES)?>" class="w-100" loading="lazy">
  36. </picture>
  37. </div>
  38. <?php endif;?>
  39. <div class="meta">
  40. <h2 class="title"><?=$model->title?></h2>
  41. <div class="lead" style="font-size: 17px; color: #888;"><?=$model->lid?></div>
  42. <div class="published_at">
  43. <?=$model->publishedAt?>
  44. <?php
  45. $count=$model->getCommentsAll()->count();
  46. ?>
  47. <?php if($count>0):?>
  48. <span class="commnets">&nbsp;<svg class="icon icon-comments"><use xlink:href="/svg/symbol/sprite-clear.svg#comments"></use></svg><?=$count?></span>
  49. <?php endif;?>
  50. </div>
  51. </div>
  52. </a>
  53. </div>
  54. </div>
  55. </div>
  56. <?
  57. } catch (Exception $e) {
  58. echo "\n<!-- нет подвязанных новостей (блок с видео)-->\n";
  59. }