I need several routes in my application to allow for a dynamic string to proceed the prefix.
Here's my route:
Router::connect('/:location/traveler/:controller/*', array('action' => 'index', 'traveler' => true, 'prefix' => 'traveler'), array('pass' => array('location')));
For instance, if I went to /south/traveler/requests it would route successfully to RequestsController::traveler_index($location = 'south').
This is what I want, but I also need HtmlHelper::link() to properly reverse route a URL array into that route.
Here's my call to HtmlHelper::link():
$this->Html->link('List Requests', array('controller' => 'requests', 'action' => 'index', 'location' => 'south'));
The prefix routing is (or should be) implied since this is being called from a view within the traveler prefix.
The URL that call spits out is:
Have I not done something correctly? Is there any way I can avoid creating a custom route class to properly reverse route these URL arrays?
You need to inform the router that
location should be a named parameter using
Router::connectNamed. See http://book.cakephp.org/view/947/Named-parameters