Re: Question about Reverse Routing
Anyone know how to do this? I've yet to figure it out...I'm really stumped On Sep 17, 1:29 pm, Kyle Decot kdec...@gmail.com wrote: Anyone have any other suggestions? I could hardcode the urls, but I would rather use reverse routing if possible. Thanks. On Sep 16, 9:57 pm, Kyle Decot kdec...@gmail.com wrote: Thanks for the reply but I'm not always going to have just the q parameter. For instance, sometimes I have something like: /search/q:search+terms/country:us/region:oh/ /search/country:us/region:oh/city:columbus/ /search/country:us/page:2/ I don't really want to use pass to send it to the controller, I would like to just get them w/ $this-params['named']. On Sep 16, 6:48 pm, brian bally.z...@gmail.com wrote: Try this: Router::connect( '/search/:q', array( 'controller' = 'skateparks', 'action' = 'index' ), array( 'q' = '[\+a-zA-Z]+', 'pass' = array('q') ) ); function index($q = null) { ... } But, personally, I think you should create a search() method and leave index() for listing *all* of your skateparks. On Wed, Sep 16, 2009 at 11:46 AM, Kyle Decot kdec...@gmail.com wrote: Thanks for the reply but I'm still getting the same results. Any other suggestions? On Sep 16, 7:15 am, Martin Westin martin.westin...@gmail.com wrote: I think you can drop the wildcard and it will work. Router::connect('/search', array('controller' = 'skateparks', 'action' = 'index')); /Martin On Sep 16, 4:38 am, Kyle Decot kdec...@gmail.com wrote: I am having a little bit of trouble w/ my reverse routing. In my routes.php file I have: Router::connect('/search/*', array('controller' = 'skateparks', 'action' = 'index')); Then in my view I do something like: $html-link(Search for Something,array (controller=skateparks,action=index,q=search+terms)); I want to get something like: http://localhost/search/q:search+terms/ but instead I get: http://localhost/skateparks/index/q:search+terms/ What is it that I am doing 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Question about Reverse Routing
Anyone have any other suggestions? I could hardcode the urls, but I would rather use reverse routing if possible. Thanks. On Sep 16, 9:57 pm, Kyle Decot kdec...@gmail.com wrote: Thanks for the reply but I'm not always going to have just the q parameter. For instance, sometimes I have something like: /search/q:search+terms/country:us/region:oh/ /search/country:us/region:oh/city:columbus/ /search/country:us/page:2/ I don't really want to use pass to send it to the controller, I would like to just get them w/ $this-params['named']. On Sep 16, 6:48 pm, brian bally.z...@gmail.com wrote: Try this: Router::connect( '/search/:q', array( 'controller' = 'skateparks', 'action' = 'index' ), array( 'q' = '[\+a-zA-Z]+', 'pass' = array('q') ) ); function index($q = null) { ... } But, personally, I think you should create a search() method and leave index() for listing *all* of your skateparks. On Wed, Sep 16, 2009 at 11:46 AM, Kyle Decot kdec...@gmail.com wrote: Thanks for the reply but I'm still getting the same results. Any other suggestions? On Sep 16, 7:15 am, Martin Westin martin.westin...@gmail.com wrote: I think you can drop the wildcard and it will work. Router::connect('/search', array('controller' = 'skateparks', 'action' = 'index')); /Martin On Sep 16, 4:38 am, Kyle Decot kdec...@gmail.com wrote: I am having a little bit of trouble w/ my reverse routing. In my routes.php file I have: Router::connect('/search/*', array('controller' = 'skateparks', 'action' = 'index')); Then in my view I do something like: $html-link(Search for Something,array (controller=skateparks,action=index,q=search+terms)); I want to get something like: http://localhost/search/q:search+terms/ but instead I get: http://localhost/skateparks/index/q:search+terms/ What is it that I am doing 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Question about Reverse Routing
I think you can drop the wildcard and it will work. Router::connect('/search', array('controller' = 'skateparks', 'action' = 'index')); /Martin On Sep 16, 4:38 am, Kyle Decot kdec...@gmail.com wrote: I am having a little bit of trouble w/ my reverse routing. In my routes.php file I have: Router::connect('/search/*', array('controller' = 'skateparks', 'action' = 'index')); Then in my view I do something like: $html-link(Search for Something,array (controller=skateparks,action=index,q=search+terms)); I want to get something like: http://localhost/search/q:search+terms/ but instead I get: http://localhost/skateparks/index/q:search+terms/ What is it that I am doing 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Question about Reverse Routing
Thanks for the reply but I'm still getting the same results. Any other suggestions? On Sep 16, 7:15 am, Martin Westin martin.westin...@gmail.com wrote: I think you can drop the wildcard and it will work. Router::connect('/search', array('controller' = 'skateparks', 'action' = 'index')); /Martin On Sep 16, 4:38 am, Kyle Decot kdec...@gmail.com wrote: I am having a little bit of trouble w/ my reverse routing. In my routes.php file I have: Router::connect('/search/*', array('controller' = 'skateparks', 'action' = 'index')); Then in my view I do something like: $html-link(Search for Something,array (controller=skateparks,action=index,q=search+terms)); I want to get something like: http://localhost/search/q:search+terms/ but instead I get: http://localhost/skateparks/index/q:search+terms/ What is it that I am doing 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Question about Reverse Routing
Try this: Router::connect( '/search/:q', array( 'controller' = 'skateparks', 'action' = 'index' ), array( 'q' = '[\+a-zA-Z]+', 'pass' = array('q') ) ); function index($q = null) { ... } But, personally, I think you should create a search() method and leave index() for listing *all* of your skateparks. On Wed, Sep 16, 2009 at 11:46 AM, Kyle Decot kdec...@gmail.com wrote: Thanks for the reply but I'm still getting the same results. Any other suggestions? On Sep 16, 7:15 am, Martin Westin martin.westin...@gmail.com wrote: I think you can drop the wildcard and it will work. Router::connect('/search', array('controller' = 'skateparks', 'action' = 'index')); /Martin On Sep 16, 4:38 am, Kyle Decot kdec...@gmail.com wrote: I am having a little bit of trouble w/ my reverse routing. In my routes.php file I have: Router::connect('/search/*', array('controller' = 'skateparks', 'action' = 'index')); Then in my view I do something like: $html-link(Search for Something,array (controller=skateparks,action=index,q=search+terms)); I want to get something like: http://localhost/search/q:search+terms/ but instead I get: http://localhost/skateparks/index/q:search+terms/ What is it that I am doing 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Question about Reverse Routing
Thanks for the reply but I'm not always going to have just the q parameter. For instance, sometimes I have something like: /search/q:search+terms/country:us/region:oh/ /search/country:us/region:oh/city:columbus/ /search/country:us/page:2/ I don't really want to use pass to send it to the controller, I would like to just get them w/ $this-params['named']. On Sep 16, 6:48 pm, brian bally.z...@gmail.com wrote: Try this: Router::connect( '/search/:q', array( 'controller' = 'skateparks', 'action' = 'index' ), array( 'q' = '[\+a-zA-Z]+', 'pass' = array('q') ) ); function index($q = null) { ... } But, personally, I think you should create a search() method and leave index() for listing *all* of your skateparks. On Wed, Sep 16, 2009 at 11:46 AM, Kyle Decot kdec...@gmail.com wrote: Thanks for the reply but I'm still getting the same results. Any other suggestions? On Sep 16, 7:15 am, Martin Westin martin.westin...@gmail.com wrote: I think you can drop the wildcard and it will work. Router::connect('/search', array('controller' = 'skateparks', 'action' = 'index')); /Martin On Sep 16, 4:38 am, Kyle Decot kdec...@gmail.com wrote: I am having a little bit of trouble w/ my reverse routing. In my routes.php file I have: Router::connect('/search/*', array('controller' = 'skateparks', 'action' = 'index')); Then in my view I do something like: $html-link(Search for Something,array (controller=skateparks,action=index,q=search+terms)); I want to get something like: http://localhost/search/q:search+terms/ but instead I get: http://localhost/skateparks/index/q:search+terms/ What is it that I am doing 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---