Re: Custom router question

2010-10-14 Thread Raisen
I created the report plugin using the cake command line: cake bake plugin report The folder structure for the plugin looks just like the main application's one - views, controllers, models, etc. So I created a view/controller for each report I want. It's very simple. Be sure to read

Re: Custom router question

2010-10-14 Thread Michael Tokar
Raisen - this looks ideal! Will try it out some time soon. Thanks for sharing. On 15 October 2010 04:28, Raisen weys...@gmail.com wrote: I created the report plugin using the cake command line: cake bake plugin report The folder structure for the plugin looks just like the main

Re: Custom router question

2010-10-13 Thread Michael T
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

Re: Custom router question

2010-10-13 Thread gremlin
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.

Re: Custom router question

2010-10-13 Thread Raisen
I've looked at the profiles routing before, and the reason I didn't like was because I couldn't use the reports name for the top folder hierarchy. So basically I have to create a sales_controller.php instead of reports_sales_controller.php But it looks like it's the only viable solution so far.

Re: Custom router question

2010-10-13 Thread Raisen
Oh yes, another question. According to the manual: You can configure the Router to use multiple prefixes too: Plain Text View Router::connect('/profiles/:controller/:action/*', array('prefix' = 'profiles', 'profiles' = true)); 1. Router::connect('/profiles/:controller/:action/*',

Re: Custom router question

2010-10-13 Thread cricket
On Wed, Oct 13, 2010 at 12:43 PM, Raisen weys...@gmail.com wrote: I've looked at the profiles routing before, and the reason I didn't like was because I couldn't use the reports name for the top folder hierarchy. So basically I have to create a sales_controller.php instead of

Re: Custom router question

2010-10-13 Thread cricket
On Wed, Oct 13, 2010 at 12:44 PM, Raisen weys...@gmail.com wrote: Oh yes, another question. According to the manual: You can configure the Router to use multiple prefixes too: Plain Text View Router::connect('/profiles/:controller/:action/*', array('prefix' = 'profiles', 'profiles' =

Re: Custom router question

2010-10-13 Thread Michael Tokar
On 14 October 2010 07:17, cricket zijn.digi...@gmail.com wrote: But let's back up a bit--do you have Sale Customer models? What I was getting at in my earlier suggestion was that you could declare options in each model for how its reporting would be conducted. For my situation at least,

Re: Custom router question

2010-10-13 Thread Raisen
I did find a way to make a reports section the way I want - plugins! Just create a reports plugin and then you can add the sales, customers, etc... controllers/views. The url will look like: http://url.com/reports/sales/ On Oct 13, 1:15 pm, Michael Tokar michael.to...@gmail.com wrote: On 14

Re: Custom router question

2010-10-13 Thread Michael Tokar
Interesting. Do you think you could post some sample code of your report plugin? On 14 October 2010 09:41, Raisen weys...@gmail.com wrote: I did find a way to make a reports section the way I want - plugins! Just create a reports plugin and then you can add the sales, customers, etc...

Custom router question

2010-10-12 Thread Raisen
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

Re: Custom router question

2010-10-12 Thread cricket
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