Why not just use a single controller that $uses each of the models in question?

Router::connect(
    '/reports/:type',
    array(
        'controller' => 'reports',
        'action' => 'view'
    ),
    array(
        'type' => '[a-z]+',
        'pass' => array('type')
    )
);

public function view($type = null)
{
    if (!$type)
    {
        // ...
    }

    $model = Inflector::modelize($type);
    // ...
}

On Tue, Oct 12, 2010 at 7:27 PM, Raisen <[email protected]> wrote:
> Assume that I have a reports page where there would be multiple sub-
> reports. I want the urls to look like:
>
> /reports/sales/
> /reports/customers/
>
> One way I managed to do that was to create actions inside the reports
> controller for each subreport, but I am trying to do something
> different. I want each subreport to have its own controller,view.
> Basically I would have a controller named:
>
> reports_sales_controller
>
> and views
>
> /reports/sales/index.ctp
>
> Is that possible?
>
> I was trying to do something like:
>
>        Router::connect('/reports/(.*)/*', array('controller'=>'$1',
> 'action'=>'index'));
>
> which probably it's way off what I want.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> 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
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to