IMO you shouldnt reinvent the wheel (with design flaws in it), but re-use 
best practice approaches via plugin form that have been working
for many years with ease:
https://github.com/CakeDC/search is the de facto standard for easy 
filtering of your paginated data

Mark


Am Donnerstag, 19. Februar 2015 15:02:10 UTC+1 schrieb ajt:
>
> Hi, 
>    
> In cakephp I can add search filters and change the post vars into Get as 
> below. This works fine. My problem is how do go to another page found from 
> the list of searches and return to the same page? All search filters are 
> gone when i return as I am not storing them.
>
> eg I search for invoice 2 and get a list of searches. i click on link from 
> the search and view a page. I then want to return to the same page with 
> same page number for invoice 2?
>
> if (($this->request->is('post') ||$this->request->is('put'))&& 
> isset($this->request->data['filter'])) {
>
>        $filter_url['controller'] = $this->request->params['controller'];
>        $filter_url['action'] = $this->request->params['action'];
>        $filter_url['page'] = 1;
> // for each filter we will add a GET parameter for the generated 
> urlforeach($this->data['Filter'] as $name => $value){
>    if($value){
>        $filter_url[$name] = urlencode($value);
>    }}   //Post params are now GET paramatersreturn 
> $this->redirect($filter_url);    
>    }//isset   
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to