Answer the question
In order to leave comments, you need to log in
Why are photos from another section shown?
I already asked a question here, but poorly formulated.
We have a photo, the paths to which are stored in the database like this
| id | name | action |
|1| photo1 | 1 |
|2| photo2 | 2 |
action
is the number of the section in which the photos should be shown. To display photos, I use the public function actionPhotos() {
$params = Yii::$app->request->queryParams;
$searchModel = new PhotosSearch();
$dataProvider = $searchModel->search($params);
return $this->render('photos', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
]);
}
'url' => '/photos/2'
echo ListView::widget([
'dataProvider' => $dataProvider,
'itemOptions' => ['class' => '.item'],
'itemView' => '_item_view',
'pager' => ['class' => ScrollPager::className(),
'enabledExtensions' => [
ScrollPager::EXTENSION_TRIGGER => 1000,
ScrollPager::EXTENSION_PAGING,
ScrollPager::EXTENSION_NONE_LEFT,
ScrollPager::EXTENSION_SPINNER => false],
'spinnerTemplate' => '<div class="ias-spinner" style="text-align: center; z-index:1800; color:red;"><img src="{src}"/></div>',
'noneLeftText' => ''
],
]);
Well_item_view
<div class="col-md-4 col-xs-12 col-sm-6 item ">
<a href="" class="photo_url" data-toggle="modal" data-img-url="<?= '/' . $model->url ?>" data-target="#foto">
<img class="img-responsive thumbnail" src="<?= '/' . $model->thumb ?>" alt="">
</a>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question