查看我对此our.umbraco.org 论坛帖子的回答。基本上,根据 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>
}