I am working on a menu and would like to improve it so that the top level pages display an icon and the name. On my textpages I have a dropdown list with the classes they can choose from. I thought it was as simple as putting in a var called icon and fetching the value via .Parameter.
My code looks like this:
@inherits umbraco.MacroEngines.DynamicNodeContext @{ @*Get the root of the website *@ var root = Model.AncestorOrSelf(1); var startNodeID = Parameter.source; @*var homePage = Parameter.frontPage;*@ } <ul> @*<li><a href="@Model.NodeById(startNodeID).NiceUrl">@homePage</a></li>*@ @foreach (var page in root.Children.Where("Visible")) { var icon = @page.Parameter.ikon; <li class="@page.IsAncestorOrSelf(Model, "current", "")"> <a href="@page.Url">@page.Name <span class="@icon"></span></a> @* LVL 2 *@ <ul> @*@foreach (var subpage in page.Children.Where("nodeTypeAlias == \"Tekstside\"").Where("Visible"))*@ @foreach (var subpage in page.Tekstside.Where("Visible")) { <li><a href="@subpage.Url">@subpage.Name</a></li> } </ul> </li> } </ul>
Razor menu with icon font and pagename
Hi guys
I am working on a menu and would like to improve it so that the top level pages display an icon and the name. On my textpages I have a dropdown list with the classes they can choose from. I thought it was as simple as putting in a var called icon and fetching the value via .Parameter.
My code looks like this:
Any ideas?
Thx in advance :)
/Michael
Hi Michael,
Assuming you want to display an icon for each item of the first level why not make use of an Upload file ?
Hope this helps,
Thank you very much Fuji :D
I used some of your code and stuck with my icon font. My working code looks like this:
Thx again
/Michael
No worries Michael, most welcome and nice input
//fuji
is working on a reply...