slimphp / Twig-View

Slim Framework view helper built on top of the Twig templating component
http://slimframework.com
MIT License
356 stars 87 forks source link

Twig_Error_Syntax - Unknown "path_for" function in . . . #62

Closed phoenixjaymes closed 8 years ago

phoenixjaymes commented 8 years ago

I've read some of the closed issues and it seems that no one, is actually having an issue using path_for. I have double and triple check for typos.

{{ path_for('home', {'name': 'home'}) }}

Everything else is working great. Any ideas what is going on?

nisbeti commented 8 years ago

Check how your home route is setup. It should have '/{name}' as the path or something like that. Also, the home route should have ->setName('home'). Also make sure that there is only one route named home. These are some common issues. If you have slip error reporting switched on the bug is usually quite explicitly stated. Finally, how have you set up Twig extension, to ensure it has access to the Slim's router? On Thu, 16 Jun 2016 at 00:46, phoenixjaymes notifications@github.com wrote:

I've read some of the closed issues and it seems that no one, is actually having an issue using path_for. I have double and triple check for typos.

{{ path_for('home', {'name': 'home'}) }}

Everything else is working great. Any ideas what is going on?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/slimphp/Twig-View/issues/62, or mute the thread https://github.com/notifications/unsubscribe/ANDEc2AyKf9nGp5yrIOkSr1U_EhFIXKnks5qMI7jgaJpZM4I25rP .

akrabat commented 8 years ago

Have you added the Slim\Views\TwigExtension extension?

phoenixjaymes commented 8 years ago

I forgot the extensions, thanks for the help. I feel a bit silly now.