I had the following code in a template in Umbraco 4.0.4.2, and it was working:
<%=umbraco.library.GetItem("hp_featuredproduct_02_img")%> I just upgraded to Umbraco 4.5, and the same code does not seem to be working. I can get the value using an umbraco:Item tag, as follows:
After some experimenting, I realized that in umbraco 4.5, I can now use <umbraco:Item field="hp_featuredproduct_02_img" runat="server"></umbraco:Item> even for html tag attributes.
So, the following works fine for me in 4.5: <img src="<umbraco:Item field="hp_featuredproduct_02_img" runat="server"></umbraco:Item>" />
and there's no need to use <%=umbraco.library.GetItem("hp_featuredproduct_02_img")%> in an html attribute.
I don't know if this is due to a change in functionality from 4.0.4.2 to 4.5, or if it was just something strange on my computer. At any rate, I'm happy now.
GetItem() in Umbraco 4.5
I had the following code in a template in Umbraco 4.0.4.2, and it was working:
<%=umbraco.library.GetItem("hp_featuredproduct_02_img")%>
I just upgraded to Umbraco 4.5, and the same code does not seem to be working. I can get the value using an umbraco:Item tag, as follows:
<umbraco:Item field="hp_featuredproduct_02_img" runat="server"></umbraco:Item>
but I need to use the <%= %> syntax, so I can use it to set an html tag attribute. Any idea why GetItem is not working?
Thanks,
Steve
After some experimenting, I realized that in umbraco 4.5, I can now use <umbraco:Item field="hp_featuredproduct_02_img" runat="server"></umbraco:Item> even for html tag attributes.
So, the following works fine for me in 4.5: <img src="<umbraco:Item field="hp_featuredproduct_02_img" runat="server"></umbraco:Item>" />
and there's no need to use <%=umbraco.library.GetItem("hp_featuredproduct_02_img")%> in an html attribute.
I don't know if this is due to a change in functionality from 4.0.4.2 to 4.5, or if it was just something strange on my computer. At any rate, I'm happy now.
is working on a reply...