index.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * @var $this \yii\web\View
  4. * @var $news_query \yii\db\ActiveQuery
  5. */
  6. use app\models\base\NewsTopic;
  7. use app\modules\ldjson\jsonLD;
  8. $page = \Yii::$app->request->get('page');
  9. $ppage = ($page)?'-'.$page:'';
  10. $addtpage = $page?". Страница ($page)":'';
  11. $this->params['breadcrumbs'] = [
  12. [
  13. "text"=>"СТАТЬИ",
  14. "url"=>"/articles"
  15. ]
  16. ];
  17. $this->title = "Лента статей: amic.ru";
  18. Yii::$app->og->title = $this->title.$addtpage;
  19. Yii::$app->og->description ='Лента Статей - '.Yii::$app->og->description.$addtpage;
  20. Yii::$app->og->og_title = str_replace( '"',"&quot;", $this->title );
  21. Yii::$app->og->og_description = str_replace( '"',"&quot;",Yii::$app->og->description);
  22. $url = '/articles';
  23. Yii::$app->og->canonical = $url;
  24. Yii::$app->og->og_type = "website";
  25. jsonLD::addAmicORG();
  26. $i = 1;
  27. foreach($this->params['breadcrumbs'] as $el){
  28. jsonLD::addBreadcrumb($i, $el['url'], $el['text']);
  29. $i++;
  30. }
  31. ?>
  32. <div class="archive">
  33. <div class="row">
  34. <div class="col-md-3">
  35. <div class="topics-list">
  36. <div class="topics-continer">
  37. <?php
  38. echo Yii::$app->cache->getOrSet("archive_rubrics-articles",function (){
  39. return \yii\widgets\ListView::widget([
  40. "dataProvider" => new \yii\data\ActiveDataProvider([
  41. "query"=>NewsTopic::find()->andWhere(["show"=>"Y","active"=>1, "topic_id"=>null])->orderBy(["order"=>SORT_ASC]),
  42. "pagination" =>[
  43. "pageSize"=>0
  44. ],
  45. ]),
  46. 'options' => [
  47. 'tag' => "ul",
  48. 'class' => 'list-wrapper',
  49. 'id' => 'list-wrapper',
  50. ],
  51. "itemOptions"=>[
  52. "tag"=>"li"
  53. ],
  54. "itemView" => function($model) {
  55. if( $model->url == '----'){
  56. $ret = \yii\helpers\Html::tag('div','',['class' => ['hr']]);
  57. $ret .= \yii\helpers\Html::tag('span',$model->title,['class' => ['header']]);
  58. return $ret;
  59. }
  60. return \yii\helpers\Html::a($model->title,["news/{$model->url}"],[]);
  61. },
  62. "layout" => "{items}"
  63. ]);
  64. },600);
  65. ?>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="col-md-9">
  70. <div class="news-list">
  71. <?=$this->render("/layouts/breadcrumbs")?>
  72. <?php
  73. echo Yii::$app->cache->getOrSet("articles_news-".$ppage,function () use($news_query){
  74. return \yii\widgets\ListView::widget([
  75. "dataProvider" => new \yii\data\ActiveDataProvider([
  76. "query"=>$news_query,
  77. "pagination" =>[
  78. "pageSize"=>20
  79. ],
  80. ]),
  81. 'options' => [
  82. 'tag' => "ul",
  83. 'class' => 'list-wrapper',
  84. 'id' => 'list-wrapper',
  85. ],
  86. "itemOptions"=>[
  87. "tag"=>"li"
  88. ],
  89. "itemView" => "archive/_archive_item",
  90. "layout" => "{items}{pager}"
  91. ]);
  92. },600);
  93. ?>
  94. </div>
  95. </div>
  96. </div>
  97. </div>