Hi there all,

I solved the problem using following routes. But I feel it is not the best
practice. What you think?

//also @ http://pastebin.com/s7nTUQ03

Zend_Controller_Front::getInstance ()->getRouter ()->addRoute (
'project_action',
        new Zend_Controller_Router_Route (
'project/:id/:controller/:action/*',
        array ('module' => 'application',
                'controller' => 'project',
                'action' => 'index', 'id' => 0 ),
                array ('id' => '\d+' ) ) );


Zend_Controller_Front::getInstance ()->getRouter ()->addRoute (
'project_overview',
        new Zend_Controller_Router_Route ( 'project/:id',
        array ('module' => 'application',
                'controller' => 'project',
                'action' => 'overview', 'id' => null ),
                array ('id' => '\d+' ) ) );

Zend_Controller_Front::getInstance ()->getRouter ()->addRoute (
'project_home',
        new Zend_Controller_Router_Route ( 'project',
        array ('module' => 'application',
                'controller' => 'project',
                'action'=>'index')));



On Wed, Oct 6, 2010 at 6:22 PM, Serkan Temizel <[email protected]>wrote:

> I am not sure if this is a router case.
>
> Here is the case;
>
> *URL
> **Controller
> **Action
> **Descirption
> *http://localhost/project
>  ProjectController
> index
> All projects list
> http://localhost/project/1 ProjectControllerdetail
> Detail of project, ID 1
> http://localhost/project/new ProjectControllernew
> New project form
> http://localhost/project/1/edit ProjectControlleredit
> Edit project ID 1
> http://localhost/project/1/users UsersController
> index
> All people related to project ID 1
> http://localhost/project/1/users/active UsersControlleractive
> Active people on project ID 1
> *and so on .... many actions on many
> different  controller like users, budget etc*
>
>
>
>
> as you see similar URL with different controllers and actions.
>
> I add the following router
>
>     Zend_Controller_Front::getInstance ()->getRouter ()->addRoute (
> 'project_view',
>    new Zend_Controller_Router_Route ( 'project/:id/:controller/:action/*',
>          array ('module' => 'application',
>                 'controller' => 'project',
>                 'action' => 'index', 'id' => 0 ),
>                  array ('id' => '\d+' ) ) );
>
> But this is a partial solution for this problem.
>
> What can be better solution? adding multiple routers or any other approach?
>
>
>
>

Reply via email to