My inline style looks like:
style="background-image: url({{ asset('bundles/testblog/images/id.jpg') }});"
the part id
of the url must change depending on a varibale. How can I make this happen inside the asset.
I tried :
style="background-image: url({{ asset('bundles/testblog/images/'{{variable}}'.jpg') }});"
But to no avail.
Use ~
for concatenation,
style="background-image: url({{ asset('bundles/testblog/images/' ~ variable ~ '.jpg') }});"
Also,
You don’t need to nest {{ ... }}
delimiters. The ones you used to wrap asset()
call are also used to print any other variable they contain.
style="background-image: url({{ asset('bundles/testblog/images/' ~ variable ~ '.jpg') }});"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With