123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- use app\models\front\News;
- $keyadd = News::keyFilter();
- ?>
- <a class="news-link" href="/news">Лента новостей</a>
- <?php if( Yii::$app->controller->action->id!="index") echo $this->render("@app/views/_etc/banners/desktopLentBannerVideo"); ?>
- <div class="lenta">
- <?= Yii::$app->cache->getOrSet("main_page_lenta_".(Yii::$app->deviceDetect->isMobile() ?"desktop":"mobile").Yii::$app->controller->action->id.$keyadd,function () {
- $lenta = "<div id='list-wrapper' class='list-wrapper'>";
- /*
- // Фиксированные новости или банера в верху ленты
- ## пример "День поля"
- */
- /* $lenta .= '<style>.lenta .list-wrapper .lenta_fix:hover{background:#60b740;}</style>
- <div class="lenta_fix"><h3>
- <a href="/story/den_sibirskogo_polya_2023" title="День Сибирского поля-2023"><img src="/img/day_pole.svg" width="275px" height="80px" alt="День Сибирского поля"></a><div class="published_at">28-29 июня</div>
- </h3>
- </div>
- ';
- <br><span class="timer__seconds"></span>
- */
- $lenta .= '<style>.lenta .list-wrapper .lenta_fix:hover{background:#60b740;}</style>
- <div class="lenta_fix"><div style="text-align: center;font-weight: 600;">До окончания номинирования</div><h3>
- <a href="https://%D0%BD%D0%B0%D1%80%D0%BE%D0%B4%D0%BD%D1%8B%D0%B9%D0%B7%D0%BD%D0%B0%D0%BA%D0%BA%D0%B0%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%B0.%D1%80%D1%84" title="Народный знак качества"><img src="/img/nzk_button.png" width="275px" height="80px" alt="Народный знак качества" style="margin-left: -20px;"></a>
- <div class="count" style="font-size:20px;width:130px;line-height: 24px;"><span class="timer__days"></span><br><span class="timer__hours"></span><br><span class="timer__minutes"></span></div>
- </h3>
- </div>
- ';
- $index = 0;
- foreach (News::findFilter()->andWhere(["(flags & 1)"=>0])->limit(70)->all() as $model){
- $index++;
- $lenta.= \yii\helpers\Html::tag('div',$this->render('_item',["model"=>$model])) ;
- if($index==3) $lenta.=$this->render("@app/views/_etc/banners/mobileMainPageLentBanner");
- if($index==10 && Yii::$app->controller->action->id!="index") $lenta.=$this->render("@app/views/_etc/banners/desktopLentBanner");
- if($index==20 && Yii::$app->controller->action->id!="index") $lenta.=$this->render("@app/views/_etc/banners/desktopLent20Banner");
- if($index>20 && ($index % 10)==0 && Yii::$app->controller->action->id!="index" ) $lenta.=$this->render("@app/views/_etc/banners/desktopLent20Banner",["index"=>$index]);
- }
- $lenta.="</div>";
- return $lenta;
- },News::$keysCache['main_page_lenta']);
- ?>
- <div class="all-news">
- <a href="/news">Все новости</a>
- </div>
- </div>
- <?
- $this->render('countdown');
|