I didn't read all of the code, but basically I like Mile J's way better (and that's the way I have been doing it myself).
The problem with saving stuff in the session is that a) You can't bookmark (but just like you said, oh well ;)) b) You can't have multiple search running in multiple tabs/windows c) You can't copy/paste the url (sort of goes with a), but it's way more annoying in my opinion). Also, I'm thinking that adressing b) could generate a large amount of data in the session. And yah, it works quite well with named parameters :) Jimmy On 14 fév, 16:17, Miles J <[email protected]> wrote: > I don't see anything wrong with that, and if it works then great. I > currently do something like this but instead of saving to the session, > I post to another action and redirect with the named params. Perhaps > the session would be easier since it doesn't require so many > redirects. > > /** > * Browse our directory of games > * @access public > */ > function browse() { > $this->data['Game'] = array( > 'name' => urldecode($this->getNamedParam('name')), > 'genre' => $this->getNamedParam('genre'), > 'isReleased' => $this->getNamedParam('isReleased') > ); > > // Browsing filters > if (!empty($this->data['Game']['name'])) { > $this->paginate['Game']['conditions']['Game.name > LIKE'] = '%'. > $this->data['Game']['name'] .'%'; > } > > if (!empty($this->data['Game']['genre'])) { > $this->paginate['Game']['conditions']['Genre.id'] = > $this->data > ['Game']['genre']; > } > > if ($this->data['Game']['isReleased'] == 1) { > > $this->paginate['Game']['conditions']['Game.releaseDate <='] = date > ('Y-m-d'); > } > > $this->pageTitle = __d('games', 'browseGamesTitle', true); > $this->set('results', $this->paginate('Game')); > $this->set('genres', $this->Game->Genre->getTree()); > } > > /** > * Sorts the named params for browse > * @access public > */ > function browse_proxy() { > $data = array_map('urlencode', $this->data['Game']); > $router = array_merge(array('controller' => 'games', 'action' > => > 'browse'), $data); > $this->redirect($router); > } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
