CakePHP 5.x User Management Premium Plugin Version 5.0.x
How to use pagination in plugin and outside plugin
1. Set pagination variable in your controller e.g. in UsersController.phppublic $paginate = ['limit'=>25];
2. Now in controller's action you should get results from database in following way e.g. in index function$this->paginate = ['limit'=>10, 'order'=>['Users.id'=>'DESC']];
$paginated = $this->paginate($this->Users->find()->where($cond));
$users = $paginated->toArray();
$this->set(compact('paginated', 'users'));
3. Now in template file you should add pagination element in following way e.g. in index.php after the results table<?php
if(!empty($users)) {
echo $this->element('Usermgmt.pagination', ['paginationText'=>__('Number of Users')]);
}?>
where
$users is result variable, set from controller's action.
'Usermgmt.pagination' is a pagination element location is yourapp/plugins/Usermgmt/templates/elements/pagination.php.
'paginationText' is a pagination text to be displayed on pagination bar.
For more information see
Users Controller yourapp/plugins/Usermgmt/src/Controller/UsersController.php
index Template yourapp/plugins/Usermgmt/templates/Users/index.php
index Template yourapp/plugins/Usermgmt/templates/Users/all_users.php
Pagination Element yourapp/plugins/Usermgmt/templates/element/pagination.php