I think the reason why this is not working could maybe be because of the new template system, which as you surely know is based entirely on the .NET masterpages.
And I don't think you are allowed to assign values to attributes like we could do in earlier versions than v4. But I am not quite sure. Just a thought since my first suggestion does not work either.
@Warren: It's for a solution that is running multiple similar sites. Each is using the same template system, but has a single, simple custom CSS that changes site logo, colors and simple stuff like that.
Glad removing the runat="server" attribute sorted the problem.
On a side note, here is what I usually do instead of including <umbraco:Item> tags in attributes - I use the "insertTextBefore" and "insertTextAfter" properties.
Using a docs property as an HTML attribute
Hi there,
I'm trying to upgrade a site's template from v3 to v4, and have come across a problem that's probably pretty simple to answer.
I'm trying to insert a documents property as a value in an HTML attribute, like this:
But the output comes out all wrong:
How do I fix this? What am I doing wrong here?
Best regards,
Soeren S.
try
changing
to
Nope, no luck. It still comes out all wrong :-/
/SoerenS
Would it be a possibility for you to make it as an xslt macro instead?
I am quite sure that it should be possible to have an XSLT macro inserted into the href attribute and getting the correct value.
/Jan
OK try this single quotes for the item in the double quotes, should hopefully fix it.
Sorry just seen that Ismail suggested that, but what is the ouput when you do it with single quotes?
Close to being the same:
Not sure why it keeps insisting on writing <
When I copy the stuff outside of the HTML attribute it works just fine.
@Jan: Yeah, when I give up that'll be the solution. It just bothers me why I can't figure out getting something as simple as this to work...
/SoerenS
Strike my suggestion - does'nt work in v4...
But I guess the solution would be to make a macro in, which you write something like this
/Jan
I am not sure why it would be rendering it like that as when you insert an umbraco:item into a src attribute of an <img> tag it works just fine.
Can I ask why you have a field to store a path to a customCSS file, as maybe this could be implemented easier to avoid this problem?!
Warren
Hah, found it!
I've been using the default Runway site template, that starts out with:
Seems like when you tell an element to be run server side you'll have problems with macros.
Thanks for trying to help guys!
/SoerenS
I think the reason why this is not working could maybe be because of the new template system, which as you surely know is based entirely on the .NET masterpages.
And I don't think you are allowed to assign values to attributes like we could do in earlier versions than v4. But I am not quite sure. Just a thought since my first suggestion does not work either.
Maybe some .NET experts can clear this one out?
/Jan
@Warren: It's for a solution that is running multiple similar sites. Each is using the same template system, but has a single, simple custom CSS that changes site logo, colors and simple stuff like that.
/SoerenS
Yep, runat="server" is the culprit; Richard has done a blogpost on that...
@Dirk: Ah, I knew I've read about the problem somewhere! That's why it was extra super annoying that I couldn't find a solution right away :-P
Thanks for all the help!
/SoerenS
Glad you got it solved - if only you could mark your own post as the solution !
Glad you got it solved - if only you could mark your own post as the solution !
this works fine, change it to meet your requirements
<umbraco:Item ID="m_metaKeywords" Field="metaKeywords" runat="server" Xslt="concat('<meta name="keywords" content="',{0},'"/>')" XsltDisableEscaping="true" recursive="true"></umbraco:Item>
Glad removing the runat="server" attribute sorted the problem.
On a side note, here is what I usually do instead of including <umbraco:Item> tags in attributes - I use the "insertTextBefore" and "insertTextAfter" properties.
This way if the "siteCustomCSS" property has no value, the rest of the <link /> tag will not be rendered.
is working on a reply...