How to use absolute path in twig functions

Symfony 2.7 has a new absolute_url which can be used to generate the absolute url.
http://symfony.com/blog/new-in-symfony-2-7-the-new-asset-component#template-function-changes

It will work on those both cases or a path string:

<a href="https://stackoverflow.com/questions/17049712/{{ absolute_url(path("route_name', {'param' : value})) }}">A link</a>

and for assets:

<img src="https://stackoverflow.com/questions/17049712/{{ absolute_url(asset("bundle/myname/img/image.gif')) }}" alt="Title"/>

Or for any string path

<img src="https://stackoverflow.com/questions/17049712/{{ absolute_url("my/absolute/path') }}" alt="Title"/>

on those tree cases you will end up with an absolute URL like

http://www.example.com/my/absolute/path

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)