I've been searching for the best way to do this for a while and I
agree with Martin now. I really wish cake had a more elegant solution,
but this one is definitely the cleanest and fastest.

Just so it's out there, I extended this idea to take care of the
entire query string (what cake calls params['pass']). I don't know if
my code is the best since this is my first cake project ever but it
definitely works well.

function searchParse() {
        $paramString ='';

        // Cycle through each param
        foreach($this->params['url'] as $arg => $val) {
            // Make sure we skip url
            if($arg !== 'url')
                $paramString .= '/'.$arg.':'.$val;
        }

        // Redirect to the search action with all the named params
        $this->redirect('search'.$paramString);
}

On Feb 11, 2:30 am, Martin Westin <martin.westin...@gmail.com> wrote:
> Hi Miles,
> One way that works really well is to have a "proxy" action accepting
> the initial search. This action reorganizes the get or post 
> parametersintonamedones and redirects to the "real" action. It sound a bit
> convoluted but it is a pretty common technique that offers a lot of
> flexibility
>
> In its simplest form it could simply look like:
>
> function proxy_search() {
>         if ( !empty($this->params['url']['name']) ) {
>                 $this->redirect('search/name:'.$this->params['url']['name']);
>         }
>
> }
>
> On Feb 11, 9:40 am, Miles J <mileswjohn...@gmail.com> wrote:
>
> > So I have a search/browse system thats pluggedintopagination.
> > Everything works fine as a $_POST, the data is returned and paginated
> > BUT the second I resort the results using the pagination, I lose all
> > the search queries/terms.
>
> > How can I turn $_GETor $_POSTintonamedparamsso that they are
> > continually passed to pagination?

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

Reply via email to