Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
Running version 4.5.2, I've got this in a template
<div id="content-wrap" style="background-image:url(<umbraco:Item runat="server" field="backgroundImage" xslt="concat('',umbraco.library:GetMedia({0}, true())/umbracoFile, '')" xsltDisableEscaping="true"/>);" >
It works as intended, showing the backgroundImage, but in my template editor this part
" field="backgroundImage" xslt="concat('',umbraco.library:GetMedia({0}, true())/umbracoFile, '')" xsltDisableEscaping="true"/>);" >
Is it me or version 4.5.2 that' wrong..?
Best,Morten
Yes, I think you can tidy this up by removing the concat function, which isn't doing anything but joining an empty string on either end of the umbracoFile.
xslt="umbraco.library:GetMedia( {0}, true() )/umbracoFile"
Could do that, still showing the bckg image as intended.
<div id="content-wrap" style="background-image:url(<umbraco:Item runat="server" field="backgroundImage" xslt="umbraco.library:GetMedia({0}, true())/umbracoFile" xsltDisableEscaping="true"/>);">
And still with the last part in red as if it's an error:
" field="backgroundImage" xslt="umbraco.library:GetMedia({0}, true())/umbracoFile" xsltDisableEscaping="true"/>);">
Thanks anyway...
Try surrounding the style in single rather than double quotes:
style='background-image:url(<umbraco:Item runat="server" field="backgroundImage" xslt="umbraco.library:GetMedia({0},true())/umbracoFile" xsltDisableEscaping="true"/>);'
Spot on...Thanks for you help
M:orten
Is it possible to make an inline xslt like this recursive?
Whoops, just answered that one myself, just had to add "recursive=true" like normal.
-Amir
If you want to do it with Macro here is the lines to go to your templates:
style="background-image:url(<umbraco:Macro Alias="yourbackgroundImageMacroAliasname" runat="server" />)"
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Dynamic background image via inline xslt
Hi
Running version 4.5.2, I've got this in a template
<div id="content-wrap" style="background-image:url(<umbraco:Item runat="server" field="backgroundImage" xslt="concat('',umbraco.library:GetMedia({0}, true())/umbracoFile, '')" xsltDisableEscaping="true"/>);" >
It works as intended, showing the backgroundImage, but in my template editor this part
" field="backgroundImage" xslt="concat('',umbraco.library:GetMedia({0}, true())/umbracoFile, '')" xsltDisableEscaping="true"/>);" >
Is it me or version 4.5.2 that' wrong..?
Best,
Morten
Yes, I think you can tidy this up by removing the concat function, which isn't doing anything but joining an empty string on either end of the umbracoFile.
xslt="umbraco.library:GetMedia( {0}, true() )/umbracoFile"
Could do that, still showing the bckg image as intended.
<div id="content-wrap" style="background-image:url(<umbraco:Item runat="server" field="backgroundImage" xslt="umbraco.library:GetMedia({0}, true())/umbracoFile" xsltDisableEscaping="true"/>);">
And still with the last part in red as if it's an error:
" field="backgroundImage" xslt="umbraco.library:GetMedia({0}, true())/umbracoFile" xsltDisableEscaping="true"/>);">
Thanks anyway...
Try surrounding the style in single rather than double quotes:
style='background-image:url(<umbraco:Item runat="server" field="backgroundImage" xslt="umbraco.library:GetMedia({0},true())/umbracoFile" xsltDisableEscaping="true"/>);'
Spot on...
Thanks for you help
M:orten
Is it possible to make an inline xslt like this recursive?
Whoops, just answered that one myself, just had to add "recursive=true" like normal.
-Amir
If you want to do it with Macro here is the lines to go to your templates:
style="background-image:url(<umbraco:Macro Alias="yourbackgroundImageMacroAliasname" runat="server" />)"
is working on a reply...