Pagination |
Hello I hope you can help me I try to make a pagination with CI4 but I have not succeeded
At the time of consulting the DB, only specific profiles are requested, which is number 3 Model PHP Code: public function getAll( $start = 0, $limit = 0,$role_id = '3') Controller When I do pager to get it out it doesn't work it throws me an error. ErrorException Trying to get property 'page' of non-object PHP Code: public function index()
At first glance I would have thought it would be 'pager' instead of 'page' but I haven't looked into it closely.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
PHP Code: public function index() Codeigniter First, Codeigniter Then You!!
yekrinaDigitals
(03-25-2022, 09:58 PM)luckmoshy Wrote:It doesn't work, it lists all the users and I only need to list those with role #3
I suggest that you read the CodeIgniter User Guide on Library - Pagination.
Your doing it all wrong. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-27-2022, 12:30 AM)InsiteFX Wrote: I suggest that you read the CodeIgniter User Guide on Library - Pagination. But in this case, it only loads the complete table with all the users, but not the users that I have in a certain group. If I make a pagination to the model, it loads me without the function that I created.
In my blog I get category blogs and it returns correct, I look at my code and see how I did it.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Just to add to this, I would also recommend separating the flow control and focusing on just the database query, to see if it returns what you expect, before passing it through the pagination.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
(03-28-2022, 12:23 AM)InsiteFX Wrote: In my blog I get category blogs and it returns correct, I look at my code and see how I did it. (03-28-2022, 06:21 AM)ignitedcms Wrote: Just to add to this, I would also recommend separating the flow control and focusing on just the database query, to see if it returns what you expect, before passing it through the pagination.On the part of the DB query it works without any problem, it is only the paginate section
In that case, try and work backwards with a simplified example by following the documentation.
https://codeigniter.com/user_guide/libra...ation.html
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
|
Welcome Guest, Not a member yet? Register Sign In |