I think you can use regex in routes, so probably you could do this. But then I think you would have to restrict user names to not have 's' as a last character. So it might be better for users if you copy/ paste/modify a bunch of routes so they don't gripe when they can't get an 's' on their user name?
In my opinion I think you are trying to design an inflexible system, but ultimately it is your design choice. Good luck =) On Jan 8, 11:30 pm, Rimoe <[email protected]> wrote: > Thank You for your answer.I think this is what I want to get. > > but I have too many controllers, > this is a big task to add so many routers, > and I will add more many controllers. > so, is the routes.php support the Regular expression? > because all of my controllers are end by 's'. > for example , > can I write it like this? > [ > Router::connect('/*s/*'); > Router::connect('/*', array('controller' => 'users', 'action' => 'views', > 'view')); > ] > > Rimoe > > 2009/1/8 Luenyar <[email protected]> > > > > > If you wanted to do this, you would have to setup a route for '/*' and > > point it to whichever controller/action is going to accept your > > param. So: > > > Router::connect('/*', array('controller' => 'users', 'action' => > > 'view')); > > > would allow you to get the address 'www.mysite.com/users/view/joe'by > > entering/linking to 'www.mysite.com/joe'. > > > BUT....then you lose the ability to use, for example, 'www.mysite.com/ > > posts/ <http://www.mysite.com/posts/>' to get to ' > >www.mysite.com/posts/index'unless you set up a > > specific route for it BEFORE your '/*' route. So you would need: > > > Router::connect('/posts', array('posts','index')); > > Router::connect('/announcements', array('announcements','index')); > > /*etc for every controller you want to access in this way*/ > > Router::connect('/*', array('controller' => 'users', 'action' => > > 'view')); > > > Plus, maybe there are other consequences that you might find when > > testing it if you don't specify enough routes. See if that is what > > you are looking for. > > > HTH, > > Milton > > > On Jan 7, 10:02 pm, Rimoe <[email protected]> wrote: > > > Yes, I can do these.but use the linkhttp://www.mysite.com/param1 > > > I get a error that have no the controller of param1controller.php > > > so, I think where should I need to set it, > > > let the cakephp think the param1 is a param. > > > > Thanks. > > > > 2009/1/7 gearvOsh <[email protected]> > > > > > I dont think there is a cake setting, just do this during signup. > > > > > $restricted = array('users','pages','controllername'); > > > > > if (in_array($usernameVar, $restricted)) { > > > > // do not allow registration > > > > } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
