Routing for Presenters with More than One Word in Name
- dqj
- Member | 11
The presenter Instrument works fine with my routing, but I cannot get anything to work with InstrumentSchedule, unless I write a specific route that hard-codes ‘instrumentSchedule’ in it. I have tried adding a filter table, but that does not work either:
`$router[] = new
Route(‘<presenter>[/<id>][/m/<mode>]’,
[
‘presenter’ ⇒ [
Route::VALUE ⇒ ‘Homepage’,
Route::FILTER_TABLE ⇒ [‘instrumentSchedule’ ⇒
‘InstrumentSchedule’],
],
‘action’ ⇒ ‘read’,
‘id’ ⇒ NULL
]);`
Other people must run in to this issue all the time, right?
- David Matějka
- Moderator | 6445
There are filters for converting presenter name between the URL and the
application – https://api.nette.org/…ute.php.html#…
Your InstrumentSchedule
is represented as
instrument-schedule
in the url.
You can change default filters using FILTER_OUT and FILTER_IN.