I found a way to do this. Add these methods to your AppController.php
Now if you had a url string like so: /news/archive/limit:10/?test=123
And in your controller you called these:
$this->getNamedParam('limit'); // returns 10
$this->getQueryParam('test'); // returns 123
/**
* Used to get the value of a named param
* @param mixed $var
* @param mixed $default
* @return mixed
*/
function getNamedParam($var, $default = '') {
return (isset($this->params['named'][$var])) ?
$this->params['named']
[$var] : $default;
}
/**
* Used to get the value of a get query
* @param mixed $var
* @param mixed $default
* @return mixed
*/
function getQueryParam($var, $default = '') {
return (isset($this->params['url'][$var])) ?
$this->params['url']
[$var] : $default;
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---