title="Новости"; //тест (заменить на новостьи дня и по календарику) /* $newsDataProvider = new \yii\data\ActiveDataProvider( [ "query"=>\app\models\News::getMainView()->orderBy(["dt_pub"=>SORT_DESC])->limit(50), "pagination" =>[ "pageSize"=>50 ], ] ); */ $b_date = date("Y-m-d 00:00:00",time()-60*60*24*5); $e_date = date("3000-m-d 23:59:59"); $tnow = date("Y-m-d H:i:s"); //\app\models\base\News::find()->andwhere(['between', 'dt_pub', $b_date , $e_date])->orwhere(['active'=>'N'])->orderBy(["dt_pub"=>SORT_DESC])->limit(200) //echo "SELECT * FROM `news` WHERE (`dt_pub` between '$b_date' and '$e_date' and `active`='N') or (`dt_pub` > '$tnow' and `active`='Y')"; exit; $newsDataProvider = new \yii\data\ActiveDataProvider( [ "query"=>\app\models\base\News::findBySql("SELECT * FROM `news` FORCE INDEX(`calendar`) WHERE (`dt_pub` between '$b_date' and '$e_date' and `active`='N') or (`dt_pub` > '$tnow' and `active`='Y') order by `dt_pub` DESC"), "pagination" =>[ "pageSize"=>200 ], ] ); $cache = Yii::$app->cache; /**** ****/ ?>
время | фото | заголовок | статусы | управление |
---|---|---|---|---|
=date("H:i d-m-Y",strtotime($item->dt_pub))?> | =$item->title?> =$strTopics?> =str_replace(',',' ',$item->editors)?>=$author->name?> |
=$strbage?> |