index.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * @var $this \yii\web\View
  4. * @var $topic NewsTopic
  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. $url = str_replace( '/news/', '/podcasts/', $topic->getUrl(true) );
  12. $this->params['breadcrumbs'] = [
  13. [
  14. "text"=>"Подкасты",
  15. "url"=>"/podcasts"
  16. ]
  17. ];
  18. $this->params['breadcrumbs'][] =
  19. [
  20. "text"=>$topic->title,
  21. "url"=>"/podcasts/".$url
  22. ];
  23. $this->title = $topic->title;
  24. Yii::$app->og->title =$topic->title.$addtpage;
  25. Yii::$app->og->description =$topic->description?:'Лента подкастов - '.Yii::$app->og->description.$addtpage;
  26. Yii::$app->og->og_title = strip_tags(str_replace( '"',"&quot;",$topic->title));
  27. Yii::$app->og->og_description = strip_tags(str_replace( '"',"&quot;",Yii::$app->og->description));
  28. Yii::$app->og->canonical = $url;
  29. Yii::$app->og->og_url = $url;
  30. if( file_exists(\Yii::getAlias('@webroot').$topic->image->url) ){
  31. Yii::$app->og->og_image = $topic->image->url;
  32. }
  33. Yii::$app->og->og_type = "website";
  34. jsonLD::addAmicORG();
  35. $i = 1;
  36. foreach($this->params['breadcrumbs'] as $el){
  37. jsonLD::addBreadcrumb($i, $el['url'], $el['text']);
  38. $i++;
  39. }
  40. ?>
  41. <div class="podcasts">
  42. <h1><?=$topic->title?></h1>
  43. <div class="row">
  44. <div class="col-md-12">
  45. <div class="topic_item">
  46. <div class="topic_items row">
  47. <?php
  48. echo \yii\widgets\ListView::widget([
  49. "dataProvider" => new \yii\data\ActiveDataProvider([
  50. "query"=>$topic->getNews(),
  51. "pagination" =>[
  52. "pageSize"=>21
  53. ],
  54. ]),
  55. 'options' => [
  56. 'tag' => NULL,
  57. ],
  58. "itemOptions"=>[
  59. "tag"=>NULL
  60. ],
  61. "itemView" => "_archive_item",
  62. "layout" => "{items}{pager}"
  63. ]);
  64. ?>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>