index.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * @var $this \yii\web\View
  4. * @var $news_query \yii\db\ActiveQuery
  5. */
  6. use app\models\base\NewsTopic;
  7. $this->params['breadcrumbs'] = [
  8. [
  9. "text"=>"СТАТЬИ",
  10. "url"=>"/articles"
  11. ]
  12. ];
  13. ?>
  14. <div class="archive">
  15. <div class="row">
  16. <div class="col-md-3">
  17. <div class="topics-list">
  18. <div class="topics-continer">
  19. <?php
  20. echo Yii::$app->cache->getOrSet("archive_rubrics-",function (){
  21. return \yii\widgets\ListView::widget([
  22. "dataProvider" => new \yii\data\ActiveDataProvider([
  23. "query"=>NewsTopic::find()->andWhere(["show"=>"Y","active"=>1])->orderBy(["order"=>SORT_DESC]),
  24. "pagination" =>[
  25. "pageSize"=>0
  26. ],
  27. ]),
  28. 'options' => [
  29. 'tag' => "ul",
  30. 'class' => 'list-wrapper',
  31. 'id' => 'list-wrapper',
  32. ],
  33. "itemOptions"=>[
  34. "tag"=>"li"
  35. ],
  36. "itemView" => function($model) {return \yii\helpers\Html::a($model->title,["news/{$model->url}"],[]);},
  37. "layout" => "{items}"
  38. ]);
  39. },600);
  40. ?>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="col-md-9">
  45. <div class="news-list">
  46. <?=$this->render("/layouts/breadcrumbs")?>
  47. <?php
  48. echo Yii::$app->cache->getOrSet("articles_news-",function () use($news_query){
  49. return \yii\widgets\ListView::widget([
  50. "dataProvider" => new \yii\data\ActiveDataProvider([
  51. "query"=>$news_query,
  52. "pagination" =>[
  53. "pageSize"=>20
  54. ],
  55. ]),
  56. 'options' => [
  57. 'tag' => "ul",
  58. 'class' => 'list-wrapper',
  59. 'id' => 'list-wrapper',
  60. ],
  61. "itemOptions"=>[
  62. "tag"=>"li"
  63. ],
  64. "itemView" => "archive/_archive_item",
  65. "layout" => "{items}{pager}"
  66. ]);
  67. },1);
  68. ?>
  69. </div>
  70. </div>
  71. </div>
  72. </div>