Two-level Menu
  • I want:
    first level (class="nav sections-menu") = "$gimme->section->name"
    2nd level (class="dropdown-menu profile-dropdown") = "$gimme->article->name"

    Helpme to edit header.tpl.

    <ul class="nav sections-menu">
        {{ local }}
        {{ set_current_issue }}
        {{ list_sections }}
        <li {{ if $currentsection == $gimme->section->number }}class="active"{{ /if}}>
            <a href="{{ uri options="section"}}">
            {{ $gimme->section->name }}
            <ul class="dropdown-menu profile-dropdown">
                <li>
                    <a href="{{ uri options="section"}}">$gimme->article->name
                    </a>
                </li>
            </ul>
        </a>
        </li>
        {{ /list_sections }}
        {{ /local }}
    </ul>


    Is it right?

             
    Post edited by Andrei S. at 2014-11-11 03:52:46
  • 1 Comment sorted by
  • Hi,

    yes this may work; you will need to assign value to custom variable $currentsection before the loop with 

    {{ assign var="currentsection" value=$gimme->default_section->number }}

    and of course for second-level items, put $gimme->article->name into double curly barackets too :)
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric