-- Gerry CrsH Put <[EMAIL PROTECTED]> wrote
(on Wednesday, 28 February 2007, 12:45 PM +0100):
> Probably a stupid question but on our site we have some routes that say
> 
> http://site/article/view/id/1
> 
> in 0.1.5 I created a route in the bootstrap file for every extra parameter I
> wanted to your and got them wuth the _getParam() function of the action
> but we recently upgraded to 0.8.0 and this isn't working anymore.
> 
> Do we still need to put every route we need (for different $_GET variables) in
> the bootstrapfile or is there an easier way to get these extra variables?

I'm not sure what you're trying, but the default router matches this:
    
    (/:module)?/:controller/:action/*

(module is optional)

In your action controller, you can then use _getParam($key, $default) to
fetch parameters from the URL. It proxies to the Request object, so it
will first search for those set by decomposing the URL, then grab $_GET,
then $_POST, then $_COOKIE.

In your example URL above, you have /article/view/id/1; using
_getParam(), you can do the following:

    $id = $this->_getParam('id', false);

and it will attempt to grab the 'id' parameter, giving it a value of
false if not found.

I *know* this works currently because (a) there are unit tests for it,
and (b) I have working code now that utilizes it. If it's *not* working
for you, please provide more details -- your bootstrap, the URL you were
attempting to hit, and the relevant action method.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to