Navigation menu #328
-
Navigation is not working and, I am also reviewing the document. I am not find anything in the documentation related to navigation. @Smilefounder Could you please help me out with this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @NagarRahul we are working on the documentation at the moment. It will take a bit of time to cover everything that we have done. For the navigation, I will try to have quick notes within this week then get back to you asap. |
Beta Was this translation helpful? Give feedback.
-
Hi @NagarRahul This is a quick example to loop through the Navigation Model inside the template MVC. @{
void RenderMenu(List<Mix.Cms.Lib.ViewModels.MixAttributeSetDatas.MenuItem> items, int level = 0)
{
var menuClass = level++ == 1 ? "category-mega-menu" : "";
<ul style="height: 458px; overflow: auto;" class="@menuClass">
@foreach (var cat in items)
{
var hasChildren = cat != null && cat.MenuItems.Count > 0;
var itemClass = hasChildren ? "menu-item-has-children" : "";
<li class="@itemClass">
<a href="@cat.Uri">@cat.Title</a>
@if (hasChildren) {
RenderMenu(cat.MenuItems, level);
}
</li>
}
</ul>
}
} <!-- Category Menu -->
<nav class="category-menu">
@if(navigation != null) RenderMenu(navigation.MenuItems);
</nav> Ref: https://api-docs.mixcore.org/api/Mix.Cms.Lib.ViewModels.MixAttributeSetDatas.MenuItem.html |
Beta Was this translation helpful? Give feedback.
Hi @NagarRahul
This is a quick example to loop through the Navigation Model inside the template MVC.