Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rename macro 'n' to 'mgnl-n'.

STK提供两种导航菜单:水平导航和垂直导航。水平导航显示网站层级的第一、二级,垂直导航则显示第三、四级。显示的级别数是可以配置的。主页比较特别,尽管它在网站层级里级别更高,它在水平导航里只作为第一项显示。

Table of Contents

配置导航

导航在模板原型里配置。原型为所有的页面定义导航菜单。

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
节点名

Mgnl n
default

 

Mgnl n
templates

 

Mgnl n
prototype

 

Mgnl n
navigation

 

Mgnl n
horizontal

 

mgnl-p
allOpen

false

mgnl-p
enabled

true

mgnl-p
level

1

mgnl-p
template

/templating-kit/pages/global/horizontalNavigation.ftl

Mgnl n
vertical

 

mgnl-p
allOpen

false

mgnl-p
enabled

true

mgnl-p
level

2

mgnl-p
startLevel

 2

mgnl-p
template

 /templating-kit/pages/global/verticalNavigation.ftl

...

Code Block
languagehtml/xml
titlehorizontalNavigation.ftl
[#if model.navigation.showHorizontalNavigation]
    [#assign navigation = model.navigation.horizontalNavigation/]
    [#if (model.navigation.horizontalLevel >1 && navigation.selectedItem??) && (navigation.selectedItem.level>1 || !navigation.selectedItem.leaf)]
        [#assign cssClass = "class=\"plus-navsub\""]
    [/#if]
    <div id="nav-global" ${cssClass!} role="navigation">
        <div id="nav-global-box">
            <h6>${i18n['structural.navigation']}</h6>
            [@renderNavigation navigation=navigation/]
        </div><!-- end nav-global-box -->
    </div><!-- end nav-global -->
[/#if]