Re: accessing a url param in a router
Ok, this is what I have now: Router::connect('/:id', array('controller' => 'places','action' => 'view'), array ('id' => '[a-z_0-9]{1,15}') ); The error I get is, if I enter something like: http://127.0.0.1:8084/edragon it thinks it's looking for a controller called Edragon: Missing controller You are seeing this error because controller EdragonController could not be found... class EdragonController extends AppController { Cake, helpful as usual, is slightly more confused than I am :) Zoltan On Mar 24, 4:11 pm, "nate" <[EMAIL PROTECTED]> wrote: > Yeah, that's not really how you're supposed to use it. See the > example here:http://cake.insertdesignhere.com/posts/view/10 > > On Mar 24, 1:55 pm, "Zoltan" <[EMAIL PROTECTED]> wrote: > > > I found making this the last condition seems to do the trick, but I'm > > not sure if this is the proper way to do it: > > > Router::connect('/[0-9]{1,4}', array('controller' => 'places','action' > > => 'view', $_GET['url'] )); > > > Zoltan > > > On Mar 24, 12:49 pm, "Chowsapal" <[EMAIL PROTECTED]> wrote: > > > > I'm not sure I know the best answer for this, but one thing you could > > > do is: > > > > Router::connect('/:param_name', array('controller' => 'places', > > > 'action' => 'view')); > > > > This will set $this->params['param_name'] to 123 or whatever is > > > there. As far as limiting this to only numbers, or using info from > > > the first parameter in the second one, I'm not really sure. hth. > > > > On Mar 24, 10:34 am, "Zoltan" <[EMAIL PROTECTED]> wrote: > > > > > I'm sure this has been asked before, but I haven't be able to turn up > > > > the answer: > > > > > I want to have a url like mysite/123 resolve to mysite/places/view/506 > > > > > Using 1.2, I have a route like: > > > > Router::connect('/[0-9]+', array('controller' => 'places', 'action' => > > > > 'view', $this->params['url'] <-- **doesn't work *** )); // places/ > > > > view/506 > > > > > how do I specify this? > > > > > thanks, > > > > Zoltan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: accessing a url param in a router
Yeah, that's not really how you're supposed to use it. See the example here: http://cake.insertdesignhere.com/posts/view/10 On Mar 24, 1:55 pm, "Zoltan" <[EMAIL PROTECTED]> wrote: > I found making this the last condition seems to do the trick, but I'm > not sure if this is the proper way to do it: > > Router::connect('/[0-9]{1,4}', array('controller' => 'places','action' > => 'view', $_GET['url'] )); > > Zoltan > > On Mar 24, 12:49 pm, "Chowsapal" <[EMAIL PROTECTED]> wrote: > > > I'm not sure I know the best answer for this, but one thing you could > > do is: > > > Router::connect('/:param_name', array('controller' => 'places', > > 'action' => 'view')); > > > This will set $this->params['param_name'] to 123 or whatever is > > there. As far as limiting this to only numbers, or using info from > > the first parameter in the second one, I'm not really sure. hth. > > > On Mar 24, 10:34 am, "Zoltan" <[EMAIL PROTECTED]> wrote: > > > > I'm sure this has been asked before, but I haven't be able to turn up > > > the answer: > > > > I want to have a url like mysite/123 resolve to mysite/places/view/506 > > > > Using 1.2, I have a route like: > > > Router::connect('/[0-9]+', array('controller' => 'places', 'action' => > > > 'view', $this->params['url'] <-- **doesn't work *** )); // places/ > > > view/506 > > > > how do I specify this? > > > > thanks, > > > Zoltan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: accessing a url param in a router
I found making this the last condition seems to do the trick, but I'm not sure if this is the proper way to do it: Router::connect('/[0-9]{1,4}', array('controller' => 'places','action' => 'view', $_GET['url'] )); Zoltan On Mar 24, 12:49 pm, "Chowsapal" <[EMAIL PROTECTED]> wrote: > I'm not sure I know the best answer for this, but one thing you could > do is: > > Router::connect('/:param_name', array('controller' => 'places', > 'action' => 'view')); > > This will set $this->params['param_name'] to 123 or whatever is > there. As far as limiting this to only numbers, or using info from > the first parameter in the second one, I'm not really sure. hth. > > On Mar 24, 10:34 am, "Zoltan" <[EMAIL PROTECTED]> wrote: > > > I'm sure this has been asked before, but I haven't be able to turn up > > the answer: > > > I want to have a url like mysite/123 resolve to mysite/places/view/506 > > > Using 1.2, I have a route like: > > Router::connect('/[0-9]+', array('controller' => 'places', 'action' => > > 'view', $this->params['url'] <-- **doesn't work *** )); // places/ > > view/506 > > > how do I specify this? > > > thanks, > > Zoltan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: accessing a url param in a router
I'm not sure I know the best answer for this, but one thing you could do is: Router::connect('/:param_name', array('controller' => 'places', 'action' => 'view')); This will set $this->params['param_name'] to 123 or whatever is there. As far as limiting this to only numbers, or using info from the first parameter in the second one, I'm not really sure. hth. On Mar 24, 10:34 am, "Zoltan" <[EMAIL PROTECTED]> wrote: > I'm sure this has been asked before, but I haven't be able to turn up > the answer: > > I want to have a url like mysite/123 resolve to mysite/places/view/506 > > Using 1.2, I have a route like: > Router::connect('/[0-9]+', array('controller' => 'places', 'action' => > 'view', $this->params['url'] <-- **doesn't work *** )); // places/ > view/506 > > how do I specify this? > > thanks, > Zoltan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
accessing a url param in a router
I'm sure this has been asked before, but I haven't be able to turn up the answer: I want to have a url like mysite/123 resolve to mysite/places/view/506 Using 1.2, I have a route like: Router::connect('/[0-9]+', array('controller' => 'places', 'action' => 'view', $this->params['url'] <-- **doesn't work *** ));// places/ view/506 how do I specify this? thanks, Zoltan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---