12345678910111213141516171819202122232425262728293031 |
- <?php
- use app\models\base\NewsTopic;
- use yii\widgets\ListView;
- echo Yii::$app->cache->getOrSet("archive_rubrics-amp0",function () {
- return \yii\widgets\ListView::widget([
- "dataProvider" => new \yii\data\ActiveDataProvider([
- "query"=>NewsTopic::find()->andWhere(["show"=>"Y","active"=>1,"topic_id"=>null])->orderBy(["order"=>SORT_ASC]), //"topic_id"=>$topic->id next lavel maybe
- "pagination" =>[
- "pageSize"=>0
- ],
- ]),
- 'options' => [
- 'tag' => "ul",
- 'class' => 'list-reset m0 p0 ampstart-label',
- 'id' => 'list-wrapper',
- ],
- "itemOptions"=>[
- "tag"=>"li",
- "class"=>"ampstart-nav-item"
- ],
- "itemView" => function($model) {
- if( $model->url == '----'){
- $ret = \yii\helpers\Html::tag('div','',['class' => ['hr']]);
- //$ret .= \yii\helpers\Html::tag('span',$model->title,['class' => ['header']]);
- return $ret;
- }
- return \yii\helpers\Html::a($model->title,["news/{$model->url}"]);
- },
- "layout" => "{items}"
- ]);
- },1);//NewsTopic::$keysCache['archive_rubrics-##']
|