params['breadcrumbs'] = [ [ "text"=>"НОВОСТИ", "url"=>"/news" ] ]; $page = \Yii::$app->request->get('page'); $addpage = $page?'?page='.$page:''; $addtpage = $page?". Страница ($page)":''; if($topic instanceof NewsTopic || $topic instanceof Story || $topic instanceof Tags){ $this->params['breadcrumbs'][] = [ "text"=>$topic->title, "url"=>$topic->url ]; $addtitle = ( $topic instanceof Tags )?'Тег: ':''; // $addtitle = ( $topic instanceof Story )?'Сюэет: ':''; открыть если будут дубли Yii::$app->og->canonical = $topic->getUrl(true); $this->title = $topic->title; Yii::$app->og->title = $addtitle.$topic->title.$addtpage; Yii::$app->og->description = $topic->description?:'Лента новостей - '.Yii::$app->og->description.$addtpage; Yii::$app->og->og_title = str_replace( '"',""",$topic->title); Yii::$app->og->og_description = str_replace( '"', """, Yii::$app->og->description ); }else{ Yii::$app->og->title = 'Лента новостей - '.Yii::$app->og->title.$addtpage; Yii::$app->og->description = 'Лента новостей - '.Yii::$app->og->description.$addtpage; Yii::$app->og->og_title = str_replace( '"',""", Yii::$app->og->title ); Yii::$app->og->og_description = str_replace( '"',""", Yii::$app->og->description ); Yii::$app->og->canonical = Url::base('https')."/news".$addpage; } //$pages->setPageSize(0,true); ?>
cache->getOrSet("archive_rubrics-{$topic->id}",function () use($topic){ 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-wrapper', 'id' => 'list-wrapper', ], "itemOptions"=>[ "tag"=>"li" ], "itemView" => function($model) use($topic) { 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}"],['class'=>$model->id==$topic->id?"active":""]); }, "layout" => "{items}" ]); },NewsTopic::$keysCache['archive_rubrics-##']); ?>
render("/layouts/breadcrumbs")?> render("archive/filters")?> request; $ppage = $request->get('page'); $ppage = ($ppage)?'-'.$ppage:''; $daterange = $request->get('daterange'); $dr = ($daterange)?'-'.$daterange:''; echo Yii::$app->cache->getOrSet("archive_news-{$adkey}{$dr}{$topic->id}{$ppage}",function () use($news_query, $pages){ return ListView::widget([ "dataProvider" => new \yii\data\ActiveDataProvider([ "query"=>$news_query, "pagination"=>$pages, "totalCount"=>$pages->totalCount, ]), 'options' => [ 'tag' => "ul", 'class' => 'list-wrapper', 'id' => 'list-wrapper', ], "itemOptions"=>[ "tag"=>"li" ], "itemView" => "archive/_archive_item", "layout" => "{items}{pager}" ]); },NewsTopic::$keysCache['archive_news-##']); ?>