index.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/', '/video/', $topic->getUrl(true) );
  12. $this->params['breadcrumbs'] = [
  13. [
  14. "text"=>"Видео.amic",
  15. "url"=>"/video"
  16. ]
  17. ];
  18. $this->params['breadcrumbs'][] =
  19. [
  20. "text"=>$topic->title,
  21. "url"=>"/video/".$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. $url = str_replace( '/news/', '/video/', $topic->getUrl(true) );
  29. Yii::$app->og->canonical = $url;
  30. Yii::$app->og->og_url = $url;
  31. if( file_exists(\Yii::getAlias('@webroot').$topic->image->url) ){
  32. Yii::$app->og->og_image = $topic->image->url;
  33. }
  34. Yii::$app->og->og_type = "website";
  35. jsonLD::addAmicORG();
  36. $i = 1;
  37. foreach($this->params['breadcrumbs'] as $el){
  38. jsonLD::addBreadcrumb($i, $el['url'], $el['text']);
  39. $i++;
  40. }
  41. ?>
  42. <div class="podcasts">
  43. <h1><?=$topic->title?></h1>
  44. <div class="row">
  45. <div class="col-md-12">
  46. <div class="topic_item">
  47. <div class="topic_items row">
  48. <?php
  49. echo \yii\widgets\ListView::widget([
  50. "dataProvider" => new \yii\data\ActiveDataProvider([
  51. "query"=>$topic->getNews(),
  52. "pagination" =>[
  53. "pageSize"=>21
  54. ],
  55. ]),
  56. 'options' => [
  57. 'tag' => NULL,
  58. ],
  59. "itemOptions"=>[
  60. "tag"=>NULL
  61. ],
  62. "itemView" => "_archive_item",
  63. "layout" => "{items}{pager}"
  64. ]);
  65. ?>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>