Skip to content

Instantly share code, notes, and snippets.

@basememara
Last active December 16, 2015 10:29
Show Gist options
  • Save basememara/5420184 to your computer and use it in GitHub Desktop.
Save basememara/5420184 to your computer and use it in GitHub Desktop.
SF MVC Navigation View (2-level)
@model SitefinityWebApp.Mvc.Models.NavigationViewModel
@if (Model.DisplayParentTitle)
{
@Html.Raw(string.Format(Model.TitleFormat, Model.RootPage.Title))
}
<ul class="@Model.CssClass">
@for (int i = 0; i < Model.RootPage.Items.Count; i++)
{
<li class="@Model.RootPage.Items[i].SafeName @if (i == Model.RootPage.Items.Count - 1)
{ <text>last</text> }
else if (i == 0)
{ <text>first</text> }">
<a href="@Model.RootPage.Items[i].Url"><span>@Model.RootPage.Items[i].Title</span></a>
@if (@Model.DisplayLevel2 && Model.RootPage.Items[i].Items != null && Model.RootPage.Items[i].Items.Count > 0)
{
<ul>
@for (int j = 0; j < Model.RootPage.Items[i].Items.Count; j++)
{
<li class="@Model.RootPage.Items[i].SafeName @if (j == Model.RootPage.Items[i].Items.Count - 1)
{ <text>last</text> }
else if (j == 0)
{ <text>first</text> }">
<a href="@Model.RootPage.Items[i].Items[j].Url"><span>@Model.RootPage.Items[i].Items[j].Title</span></a>
</li>
}
</ul>
}
</li>
}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment