Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I am trying to display all the files and folders within the media section in a tree like structure eg folder then sub folders then files.
at the moment all I am getting is a flat file structure showing all the folders at the same level
My code is below any help much appreciated
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using umbraco.MacroEngines;
@{ var fileId = Model.MacroParameters["DocumentsFolder"]; if (fileId != null) { var fileList = Umbraco.Media(@fileId).Descendants(1); foreach (var file in fileList) { if (file.DocumentTypeAlias == "Folder") { <li> <h3><i class="fa fa-folder "></i> @file.Name</h3> <ul> @if (file.Children().Any()) { foreach (var file2 in file.Children("File")) { if (@file2.displaytitle != "") { <li><a href="@file2.Url"><i class="fa fa-file "></i> @file2.displaytitle</a></li> } else { <li><a href="@file2.Url"><i class="fa fa-file "></i> @file2.Name</a></li> } } } </ul> </li> } } } } </ul>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Displaying Media Items in a explorer like structure
Hi
I am trying to display all the files and folders within the media section in a tree like structure eg folder then sub folders then files.
at the moment all I am getting is a flat file structure showing all the folders at the same level
My code is below any help much appreciated
@using umbraco.MacroEngines;
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.