Q
Q
Quber2014-06-27 09:55:40
symfony
Quber, 2014-06-27 09:55:40

How to predefine the packageName parameter of the asset function in Twig in Symfony?

The Symfony twig template engine defines the following function {{ asset(path, packageName) }}
I know its purpose. With path, too, everything is clear. But how to set the packageName? Explain, please!
This is necessary to use such constructions:

{{ asset("foo.png", "image") }}
{{ asset("bar.js", "script") }}

Outcome:
http://site.ru/uploads/images/foo.png
http://site.ru/files/scripts/bar.js

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Solovyov, 2014-06-27
@Quber

symfony2.5, {{ asset('images/foo.png', absolute=true) }} = site.ru/images/foo.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question