index.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. $this->params['breadcrumbs'] = [
  13. [
  14. "text"=>$topic->title,
  15. "url"=>$topic->url
  16. ]
  17. ];
  18. $this->title = $topic->title;
  19. Yii::$app->og->title =$topic->title.$addtpage;
  20. Yii::$app->og->description =$topic->description?:'Лента подкастов - '.Yii::$app->og->description.$addtpage;
  21. Yii::$app->og->og_title = $topic->title;
  22. Yii::$app->og->og_description = Yii::$app->og->description;
  23. $url = str_replace( '/news/', '/', $topic->getUrl(true) );
  24. Yii::$app->og->canonical = $url;
  25. Yii::$app->og->og_type = "website";
  26. jsonLD::addAmicORG();
  27. $i = 1;
  28. foreach($this->params['breadcrumbs'] as $el){
  29. jsonLD::addBreadcrumb($i, $el['url'], $el['text']);
  30. $i++;
  31. }
  32. ?>
  33. <div class="podcasts">
  34. <h1><?=$this->title?></h1>
  35. <div class="row">
  36. <div class="col-md-12">
  37. <?php foreach (NewsTopic::find()->andWhere(["show"=>"Y","active"=>1,'topic_id'=>$topic_id])->orderBy(["order"=>SORT_ASC])->all() as $topic): /** @var $topic NewsTopic */?>
  38. <div class="topic_item">
  39. <h2 class="topic_title">
  40. <a href="/podcasts/<?=$topic->url?>" title="<?=$topic->title?>"><?=$topic->title?></a>
  41. <a href="/podcasts/<?=$topic->url?>" title="<?=$topic->title?>">
  42. <div class="video-list-title-link">
  43. <svg class="icon icon-play">
  44. <use xlink:href="/svg/symbol/sprite-styled.svg#play"></use>
  45. </svg>
  46. </div>
  47. </a>
  48. </h2>
  49. <div class="topic_items row">
  50. <?php
  51. $news = $topic->getNews()->limit(3)->all();
  52. foreach ($news as $post){ /** @var $post \app\models\front\News */
  53. echo $this->render('archive/_archive_item',["model"=>$post]);
  54. }
  55. ?>
  56. </div>
  57. </div>
  58. <?php endforeach;?>
  59. </div>
  60. </div>
  61. </div>