Pagination with filters |
[eluser]soprabaixar1[/eluser]
I am developing a customizable library of "pagination", now I'm putting filters. Since no standard amount of a filter for each page that will use this library, I thought of putting in an array. Here's an example: Code: $filter = array( This array should be used in the controller that is calling the libray customizable pagination. It's running in part, the problem is when I go to the next page, all variables are zero. To resolve this, I think the principle of sending a GET these filters, but do not know how I can get this control since it does not have the amount of filters, the url already has information regarding the sorting. ORDERBY (ID), ORDER_TYPE (ASC, DESC). I've done the sorting for the control of type: Code: $this->orderBy = $this->uri->segment(3); My problem now is with the filters, which would be the best way to solve?
[eluser]wh1tel1te[/eluser]
$_POST vars do not carry across pages unless you re-submit the form. I suggest saving your $_POST vars to session and using those in your $filter array. Remember to clear the session when necessary.
[eluser]soprabaixar1[/eluser]
As for the post, I can pick up the controller and return to the view. And testing: if (isset($_POST['x'])) print $_POST['x']; I'm thinking of sending a GET, but what better way to send so many parameters that do not even know how many filters can have?
[eluser]Glazz[/eluser]
Save them in a database and send the id through the url so in your controller/model you can query the database and retrieve that params.
[eluser]soprabaixar1[/eluser]
Anyone with any other suggestions? Without using the database. I think more interest in making a GET.
[eluser]osci[/eluser]
Look at wh1tel1te's comment. No database, just sessions. You don't like that approach?
[eluser]soprabaixar1[/eluser]
I need a link accessible. There are several sites that link is accessible, that is, if I copy the link into your browser address exactly that I can access content on that page, with those filters, etc.. So I think by GET is the best solution, I will not depend on the User Session.
[eluser]wh1tel1te[/eluser]
How to enable $_GET in 1.7.x Not sure if you also need to do this in 2.0.x, haven't tried GET vars in it yet.
[eluser]osci[/eluser]
in that case why not use just another segment that has the info you want. That segment would be an array to string of your $_POSTS which could be translated back to an array afterwards. The only con to this method is the choice of delimiter for your array to string. |
Welcome Guest, Not a member yet? Register Sign In |