Render different latte for different URL parts
Notice: This thread is very old.
- Garcha
- Member | 9
Hello I've such thing in RouteFactory:
$router[] = new Route('[<presenter>[/<personUrl=>[/<action>[/<entryUrl=>]]]]', 'Homepage:default');
and I have routes:
- /poets
- /poets/poet-url
- /poets/poet-url/poems
- /poets/poet-url/poems/poem-url.html
But with this setup /poets and /poets/poet-url comes to same method, and
default.latte is rendered.
How can I easily have different lattes in this case? Such that not modify route
implementation.
Thannks
- Jan Tvrdík
- Nette guru | 2595
If can call $this->setView('foo')
in presenter to render
foo.latte
instead of default.latte
or you can split
the one route into two:
$router[] = new Route('[<presenter>]', 'Homepage:default');
$router[] = new Route('<presenter>/<personUrl=>[/<action>[/<entryUrl=>]]', 'Poets:foo');