og->title = 'Новости Барнаула и Алтайского края — на сайте amic.ru ИА Амител';
Yii::$app->og->og_title = Yii::$app->og->title;
Yii::$app->og->canonical = '/';
Yii::$app->og->og_description = 'Новости в Барнауле и Алтайском крае: оперативно репортажи с фото и видео. Интересные темы, эксперты, ответы на вопросы, тесты, игры.';
Yii::$app->og->og_url = 'https://www.amic.ru';
Yii::$app->og->og_type = 'website';
Yii::$app->og->og_image = 'https://www.amic.ru/img/amic-logo.svg';
$auto_news = Yii::$app->cache->get('main_auto_news');
?>
$keyadd = News::keyFilter();
if ($this->beginCache('main-page-main-view-glob'.$keyadd, ['duration' => News::$keysCache['main-page-main-view-glob']])) {
if( $auto_news || $keyadd){
echo $this->render("index/main_view_slider",['auto'=>true]);
}else{
echo $this->render("index/main_view_slider",['auto'=>false]);
}
$this->endCache();
}
?>
=$this->render("/layouts/lenta/lenta")?>
//$this->render("index/colorful_widget",['design'=>new Design(['id'=>1]),'newsDataProvider'=>new \yii\data\ActiveDataProvider(["query"=>News::find()])])?>
if ($this->beginCache('MainPageBlock_' . ((Yii::$app->deviceDetect->isMobile())?"mobile":"desktop"), ['duration' => News::$keysCache['MainPageBlock']])) { //News::$keysCache['MainPageBlock']
if( $auto_news ){
$q = News::find()->andWhere(["(flags & 1)"=>0])->andWhere(['<>', 'id', News::getNH()->select('id')->limit(1)])->andWhere(['or',['NH'=>'Y'],['top'=>'Y']])->limit(3)->offset(3);
}else{
$q = \app\models\Kd::find()->andWhere(['>','order',2])->orderBy(["order"=>SORT_ASC])->limit(3);
}
$newsDataProvider = new \yii\data\ActiveDataProvider(
[
"query"=>$q,
"pagination" => false
]
);
$sort = $newsDataProvider->getModels();
$ActiveNews = new \yii\data\ActiveDataProvider();
$models = [];
foreach( $sort as $item ){
$models[] = \app\models\News::findOne($item->id);
}
$ActiveNews->setModels($models);
?>
=$this->render("index/three_widgets",['newsDataProvider'=>$ActiveNews])?>
andWhere(['active'=>'Y'])->orderBy(['order'=>SORT_ASC])->all();
foreach ($design as $item) {
$i++;
if($i==3) echo $this->render('@app/views/_etc/banners/firstDesktopTransparant');
if($i==6 && Yii::$app->deviceDetect->isMobile()) echo $this->render('@app/views/_etc/banners/bannerMobile3');
if($i==6 && !Yii::$app->deviceDetect->isMobile()) echo $this->render('@app/views/_etc/banners/bannerDesktop3');
/**
* @var $item Design
*/
switch ($item->design)
{
case Design::TOPIC_WIDGET:
$pageSize = 10;
break;
case Design::IMAGINE_NEWS_WIDGET:
$pageSize = 3;
break;
default:
$pageSize = 4;
}
switch ($item->type)
{
case "topic":
$newsDataProvider = new \yii\data\ActiveDataProvider(
[
"query"=>News::find()->joinWith("topics t")->andWhere(["t.id"=>[$item->parent_id], "(flags & 1)"=>0]),
"pagination" =>[
"pageSize"=>$pageSize
],
]
);
$topic = \app\models\base\NewsTopic::findOne(['id'=>$item->parent_id]);
break;
case "tag":
$newsDataProvider = new \yii\data\ActiveDataProvider(
[
"query"=>News::find()->joinWith("tags t")->andWhere(["t.id"=>[$item->parent_id], "(flags & 1)"=>0]),
"pagination" =>[
"pageSize"=>$pageSize
],
]
);
$topic = \app\models\base\Tags::findOne(['id'=>$item->parent_id]);
break;
default:
$newsDataProvider = new \yii\data\ActiveDataProvider(
[
"query"=>News::find()->joinWith("stories t")->andWhere(["t.id"=>[$item->parent_id], "(flags & 1)"=>0]),
"pagination" =>[
"pageSize"=>$pageSize
],
]
);
$topic = \app\models\base\Story::findOne(['id'=>$item->parent_id]);
break;
}
$view = \yii\helpers\ArrayHelper::getValue(Design::$id_to_view_map,$item->design,Design::$id_to_view_map[Design::IMAGINE_NEWS_WIDGET]);
echo $this->render($view,['newsDataProvider'=>$newsDataProvider,"topic"=>$topic,"design" => $item]);
}
// if(!Yii::$app->deviceDetect->isMobile()) echo $this->render('@app/views/_etc/banners/desktopfirstPage');
$this->endCache();
}
?>