Answer the question
In order to leave comments, you need to log in
How to set up a link pager?
LinkPager not showing.
controller:
public function actionIndex($page)
{
if(!isset($page)){
$page = 1;
}
$query = VpGallery::find();
$pages = new Pagination([
'totalCount' => count($query),
'pageSize' => 2,
'defaultPageSize' => 2,
'pageSizeParam' => false,
'page' => $page - 1,
]);
$models = $query->orderBy('name')->offset($pages->offset)->limit($pages->limit)->all();
return $this->render('index', ['models' => $models, 'pages' => $pages]);
}
// и так неотображается
<?php echo LinkPager::widget([
'pagination' => $pages,
]); ?>
// и так неотображается
<?= LinkPager::widget([
'pagination' => $pages,
]); ?>
Answer the question
In order to leave comments, you need to log in
Damn what a tin. The question is closed.
I changed the line in the controller from:
to:
And it appeared.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question