开发者

Read item fields in Umbraco template Programmatically

开发者 https://www.devze.com 2023-02-09 16:39 出处:网络
Im trying to read a value programmatically in an umbraco template So, instead of <umbraco:Item runat=\"server\" Field=\"url\"></umbraco:Item>

Im trying to read a value programmatically in an umbraco template

So, instead of

<umbraco:Item runat="server" Field="url"></umbraco:Item>

Id like to write

<%=umbraco.item.Field %>

Or similar :)

I have searched most of the web开发者_StackOverflow社区 now but found nothing. Any help is highly appreciated!


The current page object isn't passed into the master page or .NET macros (before Umbraco 4.6.0, 4.6.0 does kind of support that).

The only way you can do what you're after would be with:

<%= umbraco.presentation.nodeFactory.Node.GetCurrent().GetProperty("Field").Value %>
0

精彩评论

暂无评论...
验证码 换一张
取 消