Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kate 267 posts 610 karma points
    May 20, 2014 @ 16:31
    Kate
    0

    Problems with at menu again

    Hi.

    I have a menu that is doing almost as I wanted. You can see it her: http://wasteofspace.dk/version4/

    At the top of each section of the menu there is a headline - it's where it says "overskrift 1.1" og "overskrift 2.1".
    The headlines in this example is hard coded and therefore it is doing what it should - two different headlines.

    But in my script file I can't make it write different headlines.

    Hope you can help me :-)

    This is what my file looks like:

    @inherits umbraco.MacroEngines.DynamicNodeContext

    @*
    Macro to display child pages below the root page of a standard website.
    Also highlights the current active page/section in the navigation with
    the css class "current".
    *@


    @{
    @*Get the root of the website *@
    var root = Model.AncestorOrSelf(1);
    var naviLevel = Model.Level();
    }

    <nav id="menu-wrap">
    <ul id="menu" class="level-2">
    <li><h1>@Model._guidelineOverskrift</h1></li>
    @foreach (var childPage in root.Children.Where("Visible"))
    {
    <li>
    <img alt="menu navn" src="/images/ikon1.png">
    @* if the current page has any children, where the property umbracoNaviHide is not True *@
    @if (childPage.Children.Where("Visible").Any())
    {
    <div class="noLink">
    <h2>@childPage.Name</h2>
    <span>Mounting on your door, turning on, battery change</span>
    </div>
    }else{
    <a href="@childPage.Url">
    <h2>@childPage.Name</h2>
    <span>Mounting on your door, turning on, battery change</span>
    </a>
    }

    @* if the current page has any children, where the property umbracoNaviHide is not True *@
    @if (childPage.Children.Where("Visible").Any())
    {
    @* Call our helper to display the children *@
    @childPages(childPage.Children)
    }
    </li>
    }
    </ul>
    </nav>

    @helper childPages(dynamic pages)
    {
    @* Ensure that we have a collection of pages *@
    if (pages.Any())
    {
    @* Get the first page in pages and get the level *@
    var naviLevel = pages.First().Level;
    @* Add in level for a CSS hook *@


    <ul class="level-@naviLevel">

    <li class="columHeadline">
    This should change (@Model.kategoriOverskrift1)
    </li>

    @foreach (var page in pages.Where("Visible"))
    {
    <li>
    @if (page.Children.Where("Visible").Any())
    {
    <div class="noLink">@page.Name xxx</div>
    }else{
    <a href="@page.Url">@page.Name</a>
    }


    @* if the current page has any children, where the property umbracoNaviHide is not True *@
    @if (page.Children.Where("Visible").Any())
    {
    @* Call our helper to display the children *@
    @childPages(page.Children)
    }
    </li>
    }
    </ul>
    }
    }

  • Amir Khan 1282 posts 2739 karma points
    May 20, 2014 @ 18:19
    Amir Khan
    0

    Hi Kate! Where in your nodes are you setting your headline?

  • Kate 267 posts 610 karma points
    May 20, 2014 @ 20:12
    Kate
    0

    My structur look like this:

    Site
    ----- Niveau 1
           ----Niveau 2
               ----Niveau 3

    I have a headline (kategoriOverskrift2) in Niveau 2
    and a headline (kategoriOverskrift3) in Niveau 3

    Hope that answered your question :-)

     

Please Sign in or register to post replies

Write your reply to:

Draft