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
-~----------~----~----~----~------~----~------~--~---