123456789101112131415161718192021222324252627 |
- <?php
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>\app\models\News::getMainView()->orderBy(["dt_pub"=>SORT_DESC])->limit(3),
- "pagination" =>[
- "pageSize"=>4
- ],
- ]
- );
- echo \yii\helpers\Html::beginTag("div",["class"=>"main-view"]);
- echo Yii::$app->cache->getOrSet("main-page-main-view",function () use ($newsDataProvider){
- return \yii\widgets\ListView::widget([
- "dataProvider" => $newsDataProvider,
- 'options' => [
- 'tag' => false,
- 'class' => 'list-wrapper',
- 'id' => 'list-wrapper',
- ],
- "itemOptions"=>[
- "tag"=>false
- ],
- "itemView" => "_main_view_item",
- "layout" => "{items}"
- ]);
- },600);
- echo \yii\helpers\Html::endTag("div");
|