CodeIgniter Forums

Full Version: Codeigniter 3.1.10 pagination How to setup the right way?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I have used the search function of the forum, searching by title with various queries,

and I can't find a thread that helps with the subject

BUT and INSTEAD I find many pagination threads so it looks like that Codeigniter pagination is an HOT TOPIC and it is easy to understand the reason

I feel that, for a Codeigniter newbie, pagination is one of the trickier topics

together with turning the mind to the MVC and to the mechanism of calling controllers through the CI URLs mechanism

The idea is ALSO to UPDATE THE PAGINATION CONCEPTS to the CURRENT Codeigniter 3.1.10
since out there , the infos are a great confused mixture of the various CI versions.

Is this the Most Important Codeigniter Forum? Isn't it? So let's make order :-)

Here it comes this thread where I kindly ask:

Are there some gentle CI guru that want to show some frequent Codeigniter pagination situations with filtering best practices?

Yes it requires time, I know.
Butsharing is caring, and fills the souls.
I teach and I like teaching and see students understanding the point and if I were a Codeigniter guru, I would take the time to fill the below sections by myself Confused but I'm a CI newbie

What I wish is that some CI guruS of good will, will develop/add/share THE GOOD example for every section ( see below ) in a CONTEMPORARY "Codeigniter the Right Way Style" :-)

and eventually, why not, add some other situations they may have encountered

also (to me), that mean to kindly teach good advices on how to project the URL structure for the controllers and methods BEFORE to begin coding WITH THE IDEA of taking advantage of the contemporary Codeigniter 3.1.x helpers and  classes

AND OR about the right way of using routes in the routes.php and whatever else could be involved in the smartest pagination use.

Idea  The best that could happen is that an hypothetical CI FORUM GURU's COUNCIL will check the entries and eventually discuss and add modifications

Thank you in advance to those developers that will take the time to teach to people.

Here you the first common situations that comes to my mind


As it may suggest the title of this first situation, the view evoked by this controller will always show a paginated result with a prefixed query

PHP Code:
   $this->db->join('dept'' = ticket.dept_id');

In current Codeigniter 3.1.10 which is the best practice to show pagination with a fixed filters set?

I mean in the wide meaning, so it also mean which is the suggested better practice to structure the project
- VC only or MVC
- use query builder or the queries strings

Mean within the code without user interaction

Here the situation is the one where we are showing to the user e.g. the table of the customers of an international company and we will allow him to filter that HUGE list,

so in the view the user will have some dropdown where we allow the user to select/set nation, male/female, age range

and when he clicks to change another pagination page, the filter will remain applied.

Are there CI helpers for this? Should we use Cookies? How to?

4. ...

5. ...


Or how to extend the Pagination Class
E.G. when the resulting pages are some tenth, I don't like that at first sight you have

1  2  3  >  Last>

because when I click the > to browse to next page, the buttons change to

<  1  2  3  4  > Last>

and clicking again

<  1  2  3  4  5  >  Last>

and clicking again

<First  <  1  2  3  4  5  >  Last>

as you can see the next page button, slides to right at each click.
That is annoying since you want to repeatedly click on next button without having to move the mouse

Instead since pages amount is already known to be more than 5, are many tenths ,
it would be much handy to have all the buttons already present with grayed those that are not possible to click and highlighted the current page
This will also give the idea that pages are many

Ok, above are some of the topics

Thank you for participating and teaching the right way to use Codeigniter pagination

and if in Codeigniter 4 pagination is going to change, also thank you for advices on that

I wish this could become a useful thread for newbies ( like I'm )

Do you suggest to move this thread in another section of the forum?
This is the right subforum. If no one has answered, it could be because your thread rambles on, repeats itself, and is formatted inconsistently.

Thank you ciadmin...

Sorry I'm not an expert of forum threads.

I'll try to interpreter what you said , to be honest I had the impression that it got too long .

I'll try to split the concepts

Though the idea is to create a thread that won't not only answer me,
but instead,
every time some newbie asks something about pagination, this could be given as reference

Do you kindly have a suggestion on how to better handle the idea?

Write one post where to throw the idea and another where the gurus that want participate, will write about one case?

Or is all of this an utopianism? :-)

Thank you for your kind opinion