PHP建站技术分享-从入门到精通PHP建站技术分享-从入门到精通PHP建站技术分享-从入门到精通

QQ:420220301 微信/手机:150-3210-7690
当前位置:首页 > CMS教程 > ThinkCMF

限制导航层级

管理员 2024-12-15
ThinkCMF
144

我们的导航是支持无限级的,有时在制作导航时,只需要显示一级导航,或二级导航,通过设置navigation标签的 max-level 属性就可以了。

比如只显示一级导航,只要把 max-level 的值设置为1就可以了

<nav class="navbar navbar-default navbar-fixed-top active">
    <div class="container active">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="__ROOT__/">{$theme_vars.company_name|default='ThinkCMF'}</a>
        </div>

        <div class="collapse navbar-collapse active" id="bs-example-navbar-collapse-1">
            <ul id="main-menu" class="nav navbar-nav">
                <navigation nav-id="" root="" id="main-navigation" class="nav navbar-nav navbar-nav-custom"
                            max-level="1">
                    <navigationMenu root="li" class="menu-item menu-item-level-{$level} levelgt1">
                        <a href="{$menu.href|default=''}" target="{$menu.target|default=''}">
                            {$menu.name|default=''}
                        </a>
                    </navigationMenu>
                    <navigationFolder root="li"
                                      class="dropdown dropdown-custom dropdown-custom-level-{$level}"
                                      dropdown="ul"
                                      dropdown-class="dropdown-menu dropdown-menu-level-{$level}">
                        <a href="#" class="dropdown-toggle dropdown-toggle-{$level}" data-toggle="dropdown">
                            {$menu.name|default=''}<span class="caret"></span>
                        </a>
                    </navigationFolder>
                </navigation>
            </ul>
        </div>
    </div></nav>



希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。

相关推荐

扫码关注

qrcode

QQ交谈

回顶部