gpt4 book ai didi

list - 使用 Razor 获取所有文档类型 umbraco

转载 作者:行者123 更新时间:2023-12-04 16:54:40 24 4
gpt4 key购买 nike

我有一个“信息”文档类型我还有一些自定义属性。
信息标题
信息摘要
信息体
我想检索文档类型为“info”的所有文档并输出数据。
谢谢

最佳答案

这个简单的剃​​刀宏应该可以完成你想要的:

@{
// Get root node:
var root = Model.AncestorOrSelf();

// Get all descendants, filter by type:
var nodes = root.Descendants("info");

// Loop through the filtered nodes, displaying the properties:
<ul>
@foreach (var node in nodes)
{
<li>
<h2>@node.infoTitle</h2>
<div>@node.infoSummary</div>
<div>@node.infoBody</div>
</li>
}
</ul>
}

关于list - 使用 Razor 获取所有文档类型 umbraco,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11080400/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com