Closed pietmarcus closed 8 years ago
I am not entirely sure what you mean when you said,
there is no (clean) way to insert a path to a named route
Could you clarify this?
Are you speaking about inserting the router so you can resolve a URL in your template via a named route?
If this is the case, you can inject it into the renderer after you construct it.
https://github.com/slimphp/PHP-View/blob/master/src/PhpRenderer.php#L99-L101
$render->addAttribute('router', $router);
then in your template, $router->path_for();
I have added the addAttribute line to the dependencies.php-file and everything works as desired. Thanks for the tip!
As far as I can tell, there is no (clean) way to insert a path to a named route, or am I missing something? I have create a workaround which I am happy to contribute, but since I only started using the Slim Framework yesterday I want to make sure I am not missing something.