What about a custom routing prefix ( ie. admin routing ) - just add
'reports' to the prefix array and then in the sales controller do a
reports_index function and in the customers controller define a
reports_index function and cakes default routing will give you the 2
urls you used as an example.

On Oct 13, 2:22 am, Michael T <michael.to...@gmail.com> wrote:
> I have to do a similar thing in my Cake app, so I'm very interested to
> hear how you go about it in the end. For the time being I've taken
> your first approach of having a report-per-action in the one
> controller.
>
> I was thinking about defining each report in the Model layer however
> (similar to what cricket was saying) by parameterising each report
> into the necessary fields and then defining them in the app itself or
> in the database. Hadn't thought about the routing issues yet however.
>
> On Oct 13, 12:44 pm, cricket <zijn.digi...@gmail.com> wrote:
>
> > 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 <weys...@gmail.com> 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 sitehttp://cakeqs.organdhelp 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 cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to