In my fluid template I have set a variable like this:
<v:variable.set name="imageKey" value="<f:uri.resource path={image.identifier} />"/>
I then want to use this variable in my inline styling as a background-image url (it's a path to an image)
<div class="container" style="{'background-image:' {'url': '{imageKey}'}}">
<div class="image"></div>
</div>
However, this doesn't work as expected. Does anyone know the right syntax for it?
CodePudding user response:
Dont use the fluid array syntax inside the "style" attribute (as its a regular HTML attribute and not a FLUID ViewHelper Attribute or something).
Also use the inline viewhelper syntax to fill your variable.
Just do it the regular HTML/CSS syntax:
<v:variable.set name="imageKey" value="{f:uri.resource(path:image.identifier)}"/>
<div class="container" style="background-image:url('{imageKey}');">
<div class="image"></div>
</div>