I looked around for the code to get the current path in a Twig template (and not the full URL), i.e.
I don't want http://www.sitename.com/page
, I only need /page
.
Symfony – Get current URL in Twig template
symfonytwig
Related Topic
- Php – How to render a DateTime object in a Twig template
- Php – Twig templates engine: get current url
- Symfony2 + Twig get real/full current route
- Symfony – How to include CSS file in Symfony 2 and Twig
- Symfony – How to get current absolute url in twig without rendering route
- SQL Selecting finished orders with multiple operations
Best Answer
If you want to read it into a view variable:
The
app
global view variable contains all sorts of useful shortcuts, such asapp.session
andapp.security.token.user
, that reference the services you might use in a controller.