how can i return to page with same search filters
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 cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: how can i return to page with same search filters
I had a look it and it looks difficult to use. NOt sure if this is the best way to go and where is a complete example and ability to go back to the page? This doesnt really help -- 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 cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: how can i return to page with same search filters
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 cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: how can i return to page with same search filters
Trust me, it is easier than what you are trying to do :) And only 1-2 lines of code and it works out of the box. Am Donnerstag, 19. Februar 2015 23:18:56 UTC+1 schrieb ajt: I had a look it and it looks difficult to use. NOt sure if this is the best way to go and where is a complete example and ability to go back to the page? This doesnt really help -- 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 cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.