Hi I'm creating a website in version 5 and am very new to Razor.
I want a multi level navigation, something that will display the first 3 levels in the content tree.
Is anyone able to help me with this, I just need to gain a better understanding of Razor. Also I don't want the Homepage node as the variable. I just want a simple nav that can display all the items at level one, then nest levels 2 and 3 within it.
I'm using the following following code from the version 5.0.1 install starter package:
@inherits RenderViewPage @using Umbraco.Cms.Web;
@{ var Homepage = @DynamicModel; while (Homepage.ContentType.Alias != "homePage") { Homepage = Homepage.Parent; } } <ul class="dropdown"> <!--<li><a href="@Homepage.Url">Home</a></li>--> @foreach (var item in Homepage.Children) { if (@item.CurrentTemplate != null) { var childName = item.Name ?? "(No name yet)"; <li><a href="@item.Url">@childName </a></li> } } </ul>
Umbraco Version 5 Multi Level navigation Razor
Hi I'm creating a website in version 5 and am very new to Razor.
I want a multi level navigation, something that will display the first 3 levels in the content tree.
Is anyone able to help me with this, I just need to gain a better understanding of Razor. Also I don't want the Homepage node as the variable. I just want a simple nav that can display all the items at level one, then nest levels 2 and 3 within it.
I'm using the following following code from the version 5.0.1 install starter package:
This is a way to get what you want, but might not the best one:
is working on a reply...