123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * @var $post \app\models\News
- * @var \yii\data\ActiveDataProvider $newsDataProvider
- * @var \app\models\base\NewsTopic | \app\models\base\Story $topic
- * @var \app\models\Design $design
- */
- use app\models\base\Image;
- //if( YII_ENV != 'dev' ) return;
- if( $topic instanceof \app\models\base\NewsTopic ) $url = '/news/';
- if( $topic instanceof \app\models\base\Story ) $url = '/story/';
- if( $topic instanceof \app\models\base\Tags ) $url = '/tags/';
- try{
- $post = Yii::$app->cache->getOrSet("main-page-wide-video-".$design->id,function () use($newsDataProvider){
- return $newsDataProvider->models[0];
- },600);
- $model = $post;
- $preview = $model->image;
- $key = 'okey';
- ?>
- <div class="row partner-news" style="height-min:360px">
- <div class="col-md-8">
- <div class="cont">
- <iframe width="100%" height="100%" style="aspect-ratio: 16 / 9;" loading="lazy" src="<?=$design->url?>" title="<?=$topic->title?>" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
- </div>
- </div>
- <div class="col-md-4" >
- <div class="partner-news-item " data-key="<?=$key?>">
- <a href="<?=$model->url?>">
- <?php if($preview instanceof \app\models\base\Image):?>
- <div class="picture-cont-16x9">
- <picture class="w-100">
- <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"jpg")?>?v=<?=$model->rev?>" media="(min-width: 600px)">
- <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"webp")?>?v=<?=$model->rev?>" media="(min-width: 600px)">
- <img src="<?=$preview->getUrl(Image::SIZE_680x383)?>?v=<?=$model->rev?>" alt="<?=htmlentities($model->photo_title,ENT_QUOTES)?>" class="w-100" loading="lazy">
- </picture>
- </div>
- <?php endif;?>
- <div class="meta">
- <h2 class="title"><?=$model->title?></h2>
- <div class="lead" style="font-size: 17px; color: #888;"><?=$model->lid?></div>
- <div class="published_at">
- <?=$model->publishedAt?>
- <?php
- $count=$model->getCommentsAll()->count();
- ?>
- <?php if($count>0):?>
- <span class="commnets"> <svg class="icon icon-comments"><use xlink:href="/svg/symbol/sprite-clear.svg#comments"></use></svg><?=$count?></span>
- <?php endif;?>
- </div>
- </div>
- </a>
- </div>
- </div>
- </div>
- <?
- } catch (Exception $e) {
- echo "\n<!-- нет подвязанных новостей (блок с видео)-->\n";
- }
|