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,
Is there a way I can add a logo in the middle of the site menu like below using a dynamic razor file?
<ul> <li>Home</li> <li>Blog</li> <li>About</li> <li>LOGO HERE</li> <------ <li>Services</li> <li>Explore</li> <li>Contact</li> </ul>
My macro code is
@inherits umbraco.MacroEngines.DynamicNodeContext @{ var level = String.IsNullOrEmpty(Parameter.Level) ? 1 : int.Parse(Parameter.Level); var parent = @Model.AncestorOrSelf(level); if (parent != null) { <ul class="menu vertical medium-horizontal"> <li><a href="/">Home</a></li> @foreach (var item in parent.Children.Where("Visible")) { var active = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"active\"" : ""; <li@Html.Raw(active)> <a href="@item.Url">@item.Name</a> </li> } </ul> } }
Thank you.
Hi
Try to use indexOf method, something like this:
@foreach (var item in parent.Children.Where("Visible")) { if (parent.Children.Where("Visible").IndexOf(item) == 3) { <li>LOGO HERE</li> } var active = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"active\"" : ""; <li @Html.Raw(active)> <a href="@item.Url">@item.Name</a> </li> }
Hi Alex,
Thank you for your quick answer. I tried that but it didn't work. Gave me a macro error.
I think I need to define what IndexOf(item) == 3 is.
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
Add Logo In the Middle Of a Dynamic Menu
Hi,
Is there a way I can add a logo in the middle of the site menu like below using a dynamic razor file?
My macro code is
Thank you.
Hi
Try to use indexOf method, something like this:
Hi Alex,
Thank you for your quick answer. I tried that but it didn't work. Gave me a macro error.
I think I need to define what IndexOf(item) == 3 is.
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.