Re: This Router test fails when using named parameters.
You're trying to make it do two different things. Named parameter format is: /profiles/username:mustan9 "Normal" parameter format is: /profiles/mustan9. The latter has nothing to do with CakePHP's notion of 'named parameters'. Please refer to http://book.cakephp.org/view/46/Routes-Configuration On Sep 29, 10:06 am, Mathew <[EMAIL PROTECTED]> wrote: > I've been debugging this code, and I'm confused as to how Routing is > suppose to work with named parameters. > > In the Router.php file in the function mapRouteElements there is this > logic. > > if (!strpos($route[0], '*') && (!empty($pass) || !empty($named))) { > return false; > > } > > This will return false from mapRouteElement if the named array is not > empty. So if there are named parameters they are not getting handled, > and after returning to Router::url() it continues to build a simple / > gems/gemsProfiles/show/username:mustan9 URL. > > It it be possible that this code is broken? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: This Router test fails when using named parameters.
I've been debugging this code, and I'm confused as to how Routing is suppose to work with named parameters. In the Router.php file in the function mapRouteElements there is this logic. if (!strpos($route[0], '*') && (!empty($pass) || !empty($named))) { return false; } This will return false from mapRouteElement if the named array is not empty. So if there are named parameters they are not getting handled, and after returning to Router::url() it continues to build a simple / gems/gemsProfiles/show/username:mustan9 URL. It it be possible that this code is broken? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
This Router test fails when using named parameters.
I'm trying to create a custom route for my profiles controller located in plugin. I need to pass the username as a named parameter, but it doesn't seem to be working for me. Router::connectNamed(array('username')); Router::connect('/profiles/:username', array('plugin'=>'gems','controller'=>'gemsProfiles','action'=>'show'),array('pass'=>array('username'))); $url = Router::url(array('admin'=>false,'plugin'=>'gems','controller'=>'gemsProfiles','action'=>'show','username'=>'mustan9')); $this->assertEqual( $url, '/profiles/mustan9' ); This assert fails because $url is "/gems/gemsProfiles/show/ username:mustan9", and as you can see I was expecting "/profiles/ mustan9" Can anyone see what I've done wrong? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---