text_news_widget.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @var $post \app\models\News
  4. * @var \yii\data\ActiveDataProvider $newsDataProvider
  5. * @var \app\models\base\NewsTopic | \app\models\base\Story $topic
  6. * @var $design \app\models\Design
  7. */
  8. ?>
  9. <div class="text-news-widget row">
  10. <div class="col-md-12">
  11. <div class="cont">
  12. <div class="widget-title">
  13. <?=$design->title?>
  14. </div>
  15. <div class="row">
  16. <?php
  17. echo Yii::$app->cache->getOrSet("main-page-text-widget-".$design->id,function () use ($newsDataProvider){
  18. return \yii\widgets\ListView::widget([
  19. "dataProvider" => $newsDataProvider,
  20. 'options' => [
  21. 'tag' => false,
  22. 'class' => 'list-wrapper',
  23. 'id' => 'list-wrapper',
  24. ],
  25. "itemOptions"=>[
  26. "tag"=>false
  27. ],
  28. "itemView" => "_text_widget_item",
  29. "layout" => "{items}"
  30. ]);
  31. },60);
  32. ?>
  33. </div>
  34. </div>
  35. </div>
  36. </div>