Reputation: 4954
I have a twig page which I included a picture
, this picture will be loaded from a folder
(uploads
) , but the name (example.jpg
) is loaded from the database
:
<img src="{{ asset('uploads/example1.jpg') }}">
this works for me , but I want now that example1.jpg
will be passed to the twig
page :
return $this->render('MyAppExampleBundle:Default:index.html.twig', array(
'logo' => $logo)); //$logo = 'example1.jpg'
How I can do this?
I have tried <img src="{{ asset('uploads/{{logo}}') }}">
but this is illogic and doesn't work .
Any help plz
Upvotes: 0
Views: 244
Reputation: 13891
What about,
<img src="{{ asset('uploads/' ~ logo) }}">
{{ ... }}
twig delimiters can't be nested. You should then use concatenation.
Upvotes: 2