Explorar o código

video block fix

amic hai 1 ano
pai
achega
9b36270a11
Modificáronse 1 ficheiros con 8 adicións e 3 borrados
  1. 8 3
      views/site/index/wide_widget_video.php

+ 8 - 3
views/site/index/wide_widget_video.php

@@ -10,18 +10,19 @@ use app\models\base\Image;
 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;" src="https://www.youtube.com/embed/5FNI26lPfgE" 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>
+			<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>
         </div>
     </div>
     <div class="col-md-4" >
@@ -38,7 +39,7 @@ $key = 'okey';
             <?php endif;?>
             <div class="meta">
                 <h2 class="title"><?=$model->title?></h2>
-                <div class="lead" style="font-size: 17px;"><?=$model->lid?></div>
+                <div class="lead" style="font-size: 17px; color: #888;"><?=$model->lid?></div>
                 <div class="published_at">
                     <?=$model->publishedAt?>
                     <?php
@@ -53,3 +54,7 @@ $key = 'okey';
     </div>
     </div>
 </div>
+<?
+} catch (Exception $e) {
+	echo "\n<!-- нет подвязанных новостей (блок с видео)-->\n";
+}