123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- use app\models\front\News;
- use yii\widgets\ListView;
- $pages = new \yii\data\Pagination(['totalCount' => 100, 'pageSize'=>5]);
- ?>
- <style>
- .archive .news-list .author-lenta {padding:0;}
- </style>
- <div class="archive">
- <div class="news-list">
- <?php
- echo Yii::$app->cache->getOrSet("archive_news-test",function () use($author, $pages){
- return ListView::widget([
- "dataProvider" => new \yii\data\ActiveDataProvider([
- "query"=>\app\models\front\News::find()->andwhere(['author'=>$author]),
- "pagination" =>$pages,
- "totalCount"=> 100
- ]),
- 'options' => [
- 'tag' => "ul",
- 'class' => 'list-wrapper',
- 'id' => 'list-wrapper',
- ],
- "itemOptions"=>[
- "tag"=>"li"
- ],
- "itemView" => "item_test",
- "layout" => "{items}{pager}"
- ]);
- },5);
- ?>
- </div>
- </div>
|