Hello,

Is your controller named "product" or "products"? The URL you mentioned is
missing the "s" in products.

--
Hector


On Tue, Mar 23, 2010 at 6:59 AM, zeliboba <[email protected]> wrote:

>
> Hi all. I am new to ZF, so sorry if my question a bit stupid.
>
> I've got an url:
> http://localhost/product/wedding/year/2009/month/10/day/12
> As default it acts into the controller=product with action=wedding and
> params=array( 'year' = '2009', 'month' = '10', 'day' = '12' );
> I need this act to stay but I'd like it to come from more beautiful url:
> http://localhost/product/wedding/2009/10/12
>
> In this purposes I read a lot of manuals and tutorials about routers in ZF.
> So now I have in bootstrap.php:
>
>   public function _initRouters(){
>                $route = new Zend_Controller_Router_Route(
>                        'products/wedding/:year/:month/:day',
>                        array(
>                                'controller'    => 'products',
>                                'action'=> 'wedding'
>                        ),
>                        array(
>                                'year' => '\d+',
>                                'month' => '\d+'
>                        )
>                );
>                $front = Zend_Controller_Front::getInstance();
>                $router = $front->getRouter();
>                $router->addRoute( 'wedding', $route );
>                return $router;
>        }
>
> As I see that's all I have to do, to make it work as needed. But nothing
> happens.
> Tracing the layout I can see:
> $this->getRequest()->getParams();
> returns result:
> array(4) {
> ["controller"]=>  string(8) "products"
> ["action"]=>  string(7) "wedding"
> [2009]=>  string(1) "9"
> ["module"]=>  string(7) "default" }
>
> $router->getCurrentRouteName();
> returns result:
> default
>
> So as I see, the default router acts, and my custom - doesn't. Manuals says
> last added router going to act first, but in my case it doesn't.
>
> Thus I've got unsolved trouble. How to launch my custom router?
> --
> View this message in context:
> http://n4.nabble.com/Default-router-still-goes-ahead-of-custom-tp1679098p1679098.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to