Last active
August 29, 2015 14:19
-
-
Save bjarnef/a55a64c89ef53ff07c50 to your computer and use it in GitHub Desktop.
Archetype Template Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage | |
@using Archetype.PropertyConverters; | |
@using Archetype.Models; | |
@using Archetype.Extensions; | |
@{ | |
Layout = "Master.cshtml"; | |
} | |
@foreach (var fieldset in Model.Content.GetPropertyValue<ArchetypeModel>("archetype")) | |
{ | |
foreach (var prop in fieldset.Properties) | |
{ | |
@*<div>@prop.Value</div>*@ | |
if (prop.Alias == "headline" && prop.Value != "") | |
{ | |
<h2>@prop.Value</h2> | |
} | |
if (prop.Alias == "pages" && prop.Value != "") | |
{ | |
// https://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors/Multi-Node-Tree-Picker | |
// var typedMultiNodeTreePickerCSV = Model.Content.GetPropertyValue<string>("mntpFeaturePickerCSV"); | |
var typedPublishedMNTPNodeListCSV = prop.Value.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse); | |
IEnumerable<IPublishedContent> pages = Umbraco.TypedContent(typedPublishedMNTPNodeListCSV).Where(x => x != null); | |
<ul> | |
@foreach (var page in pages) | |
{ | |
<li><a href="@page.Url">@page.Id - @page.Name</a></li> | |
} | |
</ul> | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment