request->get('s'));
$page = trim(Yii::$app->request->get('page'));
$this->title = 'Подписи фото'."-".$search;
$this->params['breadcrumbs'][] = ['label' => 'Подписи фото', 'url' => ['phototitle']];
$this->params['breadcrumbs'][] = $search;
/*
//SELECT DISTINCT SUBSTRING_INDEX(LOWER(`photo_title`),':', -1) as `ph`, count(*) FROM `news` WHERE `photo_title` != '' && `photo_title` != "''" group by ph
$sql ="SELECT * FROM `news` WHERE `photo_title` like '%".$search."%' order by dt_pub";
//$query = ActiveRecord::findBySql($sql);
// print_r($query->asArray()->All());
//$countSql = 'select count(*) ' . $sql;
$dataProvider = new SqlDataProvider([
'sql' => $sql,
// 'totalCount' => Yii::$app->db->createCommand($countSql)->queryScalar(),
'pagination' => [
'pageSize' => 30,
],
]);
*/
if ($this->beginCache('fd2fsdtf_'.$page.$search, ['duration' => 3600])) {
$dataProvider = new \yii\data\ActiveDataProvider(
[
"query"=>\app\models\front\News::find()->andWhere(['like', 'photo_title', trim($search)])->orderBy(['dt_pub'=>SORT_DESC]),
'pagination' => [
'pageSize' => 30,
],
]
);
?>
фото |
дата |
Статья |
Фото подпись |
= ListView::widget([
'dataProvider' => $dataProvider,
'options' => [
'tag' => "div",
'class' => 'list-wrapper',
'id' => 'list-wrapper',
],
"itemOptions"=>[
"tag"=>"tr",'class' => '',
],
"itemView" => "_itemtitles",
"layout" => "{items}\n{pager}\n{summary}",
'pager' => [
'prevPageCssClass' => 'page-item',
'firstPageLabel' => 'Начало',
'lastPageLabel' => 'Конец',
'linkOptions' => [ 'class'=>'page-link'],
'pageCssClass' => 'page-item',
'disabledListItemSubTagOptions' => ['tag' => 'a', 'class' => 'page-link'],
]
]) ?>
$this->endCache();
}