Yes, put the parameters for the query in the URL (better) or in the
Session (easier, bad) and paginate using that.

On Thu, Jun 12, 2008 at 1:37 AM, Reza Muhammad <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm having a problem with pagination after I searched for a particular
> field.  In my index, I have a Spare parts lists, and users can search
> for a particular parts they are looking for.  The thing is, if the
> result returns more than 20 items (which I use pagination), I can't go
> to the second page, or the third page, because it will go the index
> pagination (second page/third page of all spare parts lists)
>
> Here's what I have in my parts_controller:
>
>        function index()
>        {
>                if (!empty($this->data)) {
>                        $conditions = array("or" => array("name" => "LIKE 
> %".$this-
>  >data['Part']['keyword']."%",
>                        "part_number" => "LIKE 
> %".$this->data['Part']['keyword']."%",
>                        "part_nokia" => "LIKE 
> %".$this->data['Part']['keyword']."%"));
>                        $this->set('parts', $this->paginate('Part', 
> $conditions));
>
>                } else {
>                        $this->Part->recursive = 2;
>                        $this->set('parts', $this->paginate());
>                }
>        }
>
> I think the problem is, in index, it will look for $_POST data, but,
> when I want to go to the second page, it will not go to the first "if"
> statement, and instead it will look for pagination from "else"
> statement.
>
> Is there any simpler way to do this? I'm not looking for Ajax
> solutions or anything like that, as long as it works.
>
> Thank you so much.
> reza
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to