Umbraco Razor - List Documents form Folder selected via the Media Picker
1) Create a Media Picker in your Document Type: "listFilesFromAParticularFolder"
2) Create this Macro
3) Insert the Macro in to a Template
2) Create this Macro
@using Examine
@using Examine.SearchCriteria
@using UmbracoExamine
@using System.Xml.XPath
@{
if
(@Model.listFilesFromAParticularFolder != "" &&
@Model.listFilesFromAParticularFolder != null)
{
dynamic imageFolder =
Library.NodeById(@Model.listFilesFromAParticularFolder);
<h2>Related Documents</h2>
foreach (var folder in imageFolder.Children)
{
<p>• <a
href="@folder.Url">@folder.Name</a> (@folder.umbracoExtension)</p>
<p>@folder.shortDescriptionOfTheDocument</p>
<div class="thinline">
</div>
}
}
}
3) Insert the Macro in to a Template
Comments
Post a Comment