I'm having some trouble with chaining routes in ZF1.

So basically what I want is an easy way to chain the routes, so that I only
have to define module/controller once and not over and over again each route
(which i had previously, i.e. without chains)

The array below gets passed to a Zend_Config object:

    'default' => array(
        'defaults' => array(
            'module' => 'default',
        ),
        'chains' => array(
            'index' => array(
                'defaults' => array(
                    'controller' => 'index',
                ),
                'chains' => array(
                    'index' => array(
                        'type' => 'Zend_Controller_Router_Route_Static',
                        'route' => '/',
                        'defaults' => array(
                            'action' => 'index'
                        )
                    ),
                    'photo' => array(
                        'type' => 'Zend_Controller_Router_Route_Static',
                        'route' => 'photos',
                        'defaults' => array(
                            'action' => 'photo'
                        )
                    )
                )
            ),
        ),
    );

The above syntax makes several routes and chains them by a '-', which means
I get the following:

    default-index-index
    default-index-photo

The routes are properly chained although when im echoing the urls they get
echo'd like this:

    localhost///
    localhost///photo

Which means the routes wont be found (except 1st). I know where the problem
lies but I dont know how to solve it:

Because I didn't define a `route`- and a `type`-key for the default+index
parent-chain (cause i only use those to define module and controller)  the
route has no value to put between the slashes. If i DO define the route/type
it works, but i get routes like the following:

    localhost/val1/val2/photo

...where val1 and val2 is the `route` defined in the parent chains. I want
it to have the output:

    localhost/photo


Any help? Zend manual couldnt shine much light on it for me.



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Route-chaining-with-Zend-Config-array-tp4661311.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to