查看我的回答our.umbraco.org forum post。基本上,這取決於MNTP是否使用XML或CSV,您可以執行下列操作之一:
CSV:
@using umbraco.MacroEngines
@inherits DynamicNodeContext
@if (Model.HasValue("venuesPicker"))
{
string[] ids = Model.venuesPicker.Split(',');
<ul>
@foreach (string id in ids)
{
var node = Library.NodeById(id);
if (node.Id != 0)
{
// If node exists:
<li><a href="@node.Url">@node.Name</a></li>
}
}
</ul>
}
XML:
@using umbraco.MacroEngines
@inherits DynamicNodeContext
@if (Model.HasValue("venuesPicker"))
{
<ul>
@foreach (var item in Model.venuesPicker)
{
var node = Library.NodeById(item.InnerText);
if (node.Id != 0)
{
// If node exists:
<li><a href="@node.Url">@node.Name</a></li>
}
}
</ul>
}
這有幫助嗎? – 2012-07-24 11:12:44