index.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * @var $this \yii\web\View
  4. * @var $topic_id integer
  5. */
  6. use app\models\base\NewsTopic;
  7. use app\models\base\Image;
  8. use app\modules\ldjson\jsonLD;
  9. $page = \Yii::$app->request->get('page');
  10. $addtpage = $page?". Страница ($page)":'';
  11. $topic = NewsTopic::find()->andWhere(['id'=>$topic_id])->one();
  12. $url = str_replace( '/news/', '/video/', $topic->getUrl(true) );
  13. $this->params['breadcrumbs'] = [
  14. [
  15. "text"=>"Видео.amic",
  16. "url"=>"/video"
  17. ]
  18. ];
  19. $this->params['breadcrumbs'][] =
  20. [
  21. "text"=>$topic->title,
  22. "url"=>"/video/".$url
  23. ];
  24. $this->title = $topic->title;
  25. Yii::$app->og->title = $topic->title.$addtpage;
  26. Yii::$app->og->description = $topic->description?:'Лента видео - '.Yii::$app->og->description.$addtpage;
  27. Yii::$app->og->og_title = str_replace( '"',"&quot;",$topic->title);
  28. Yii::$app->og->og_description = str_replace( '"',"&quot;",Yii::$app->og->description);
  29. $url = str_replace( '/news/', '/', $topic->getUrl(true) );
  30. Yii::$app->og->canonical = $url;
  31. Yii::$app->og->og_type = "website";
  32. jsonLD::addAmicORG();
  33. $i = 1;
  34. foreach($this->params['breadcrumbs'] as $el){
  35. jsonLD::addBreadcrumb($i, $el['url'], $el['text']);
  36. $i++;
  37. }
  38. ?>
  39. <div class="podcasts">
  40. <h1><?=$this->title?></h1>
  41. <div class="row">
  42. <div class="col-md-12">
  43. <?php foreach (NewsTopic::find()->andWhere(["show"=>"Y","active"=>1,'topic_id'=>$topic_id])->orderBy(["order"=>SORT_ASC])->all() as $topic): /** @var $topic NewsTopic */?>
  44. <div class="topic_item">
  45. <h2 class="topic_title">
  46. <a href="/video/<?=$topic->url?>" title="<?=$topic->title?>"><?=$topic->title?></a>
  47. <a href="/video/<?=$topic->url?>" title="<?=$topic->title?>">
  48. <div class="video-list-title-link">
  49. <svg class="icon icon-play">
  50. <use xlink:href="/svg/symbol/sprite-styled.svg#play"></use>
  51. </svg>
  52. </div>
  53. </a>
  54. </h2>
  55. <div class="topic_items row">
  56. <?php
  57. $news = $topic->getNews()->limit(3)->all();
  58. foreach ($news as $post){ /** @var $post \app\models\front\News */
  59. echo $this->render('archive/_archive_item',["model"=>$post]);
  60. }
  61. ?>
  62. </div>
  63. </div>
  64. <?php endforeach;?>
  65. </div>
  66. </div>
  67. </div>