5
我有一個文檔類型的「信息」我也有一些自定義的固定鏈接。用剃刀獲得文檔類型umbraco的所有文件
infoTitle infoSummary infoBody
我想要檢索的文件類型「信息」和輸出數據中的所有文件。
感謝
我有一個文檔類型的「信息」我也有一些自定義的固定鏈接。用剃刀獲得文檔類型umbraco的所有文件
infoTitle infoSummary infoBody
我想要檢索的文件類型「信息」和輸出數據中的所有文件。
感謝
這個簡單的剃刀宏應該完成你的願望:
@{
// 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>
}