I'm trying to get the following route to work:
$router->add('/([a-z]{2})/:namespace/:controller/:action/([^\/]+)', array(
'language' => 1,
'namespace' => 2,
'controller' => 3,
'action' => 4,
'location' => 5
))->setName('location');
The relevant (and for testing purposes only) line in the Volt template looks like this:
{{ url({'for': 'location', 'namespace': 'weather', 'controller': 'forecast', 'action': 'precipitation', 'location': 'Hamburg' }) }}
What I want is //weather/forecast/precipitation/Hamburg but instead all I get is //weather/forecast/precipitation/.
Next thing I tried was
$router->add('/([a-z]{2})/:namespace/:controller/:action/{location:[^\/]+}', array(
'language' => 1,
'namespace' => 2,
'controller' => 3,
'action' => 4,
))->setName('location');
which at least gives me the location in the URL, but at a totally wrong position: //Hamburg/forecast/precipitation/.
Now I've looked into the Library\Mvc\Router and the array that is passed to get() looks fine to me:
Array
(
[for] => location
[namespace] => weather
[controller] => forecast
[action] => precipitation
[location] => Hamburg
[language] => en
)
I will use my own Router to handle translated URLs, so I think we can ignore the language parameter for now. So far, the custom Router does nothing more than call the original one.
Any idea how to get the location parameter to work?