PHP code example of loveorigami / yii2-reversed-pagination
1. Go to this page and download the library: Download loveorigami/yii2-reversed-pagination library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
loveorigami / yii2-reversed-pagination example snippets
composer.phar
public function actionIndex()
{
$query = Article::find()->all();
$countQuery = clone $query;
$pages = new \loveorigami\pagination\ReversePagination(
[
'totalCount' => $countQuery->count(),
'pageSize' => 10, // or in config Yii::$app->params['pageSize']
]
);
$pages->pageSizeParam = false;
$models = $query->offset($pages->offset)
->limit($pages->limit)
->all();
return $this->render('index',
[
'models' => $models,
'pages' => $pages,
]
);
}
foreach($models as $model):
// display a model...
endforeach;
echo \loveorigami\pagination\ReverseLinkPager::widget([
'pagination' => $pages,
'registerLinkTags' => true
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.