0)?$items:50; if( isset($topic) && $topic ){ $news_query = \app\models\front\News::find()->leftJoin('news_topic_relation t', 't.news_id = id')->andWhere(['t.topic_id'=>$topic]); $newsDataProvider = new ActiveDataProvider([ "query"=>$news_query, 'sort'=> [ 'defaultOrder' => ['dt_pub' => SORT_DESC], ], "pagination" =>[ "pageSize"=>$items ], ]); ?> Лента новостей
cache->getOrSet("topics_page_lenta_".$topic,function () use ($newsDataProvider){ return \yii\widgets\ListView::widget([ "dataProvider"=>$newsDataProvider, 'options' => [ 'tag' => 'div', 'class' => 'list-wrapper', 'id' => 'list-wrapper', ], "layout" => "{items}", "itemView"=> "/layouts/lenta/_item" ]); },120); ?>
Все новости