亚洲欧洲偷拍另类|日韩无码免费不卡|亚欧无码日韩无码|熟女多毛一区二区|国模精品一二三区|国产黄视频免费看|微福利视频一区|淫荡人妻草草草草|91蜜桃人妻无码|国产精品iGAO视频网网日韩

導航列表標簽

說明:用于獲取頁面導航列表

使用方法: {% navList 變量名稱 %} 如將變量定義為navs {% navList navs %}...{% endnavList %},也可以定義為其他變量名稱,定義后,需要與下面的for循環(huán)使用的變量名稱一致。

navList 支持的參數有

  • 導航列表ID typeId typeId 為后臺的導航類別ID,默認 typeId=1,如果后臺設置了多個導航類別,可以通過typeId 來指定調用。
  • 站點ID siteId siteId 一般不需要填寫,如果你使用后臺的多站點管理創(chuàng)建了多個站點,并且想調用其他站點的數據,則可以通過指定 siteId 來實現(xiàn)調用指定站點的數據。

navList 需要使用使用 endnavList 標簽表示結束,中間使用for循環(huán)輸出內容。

navs 是一個數組對象,因此需要使用 for 循環(huán)來輸出

item 為for循環(huán)體內的變量,可用的字段有:

  • 導航標題 Title
  • 子標題 SubTitle
  • 導航描述 Description
  • 導航鏈接 Link
  • 對應分類ID PageId 如果這個導航菜單是選擇了分類的話,則存在
  • 是否當前鏈接 IsCurrent
  • 下級導航列表 NavList 下級導航內同樣具有 item 相同的字段。

代碼示例

{% navList navs %}
<ul>
    {%- for item in navs %}
        <li class="{% if item.IsCurrent %}active{% endif %}">
            <a href="{{ item.Link }}">{{item.Title}}</a>
            {%- if item.NavList %}
            <dl>
                {%- for inner in item.NavList %}
                    <dd class="{% if inner.IsCurrent %}active{% endif %}">
                        <a href="{{ inner.Link }}">{{inner.Title}}</a>
                    </dd>
                {% endfor %}
            </dl>
            {% endif %}
        </li>
    {% endfor %}
</ul>
{% endnavList %}

常見使用實例

  1. 在導航上顯示下拉分類,并且在分類下顯示產品文檔。如圖:

image image

調用代碼示例,該調用需要在后臺已經設置好二級導航的基礎上(代碼不包含css樣式控制)

<ul>
    {% navList navList with typeId=1 %}
    {%- for item in navList %}
    <li>
        <a href="{{ item.Link }}">{{item.Title}}</a>
        {%- if item.NavList %}
        <ul class="nav-menu-child">
            {%- for inner in item.NavList %}
            <li>
                <a href="{{ inner.Link }}">{{inner.Title}}</a>
                {% archiveList products with type="list" categoryId=inner.PageId limit="8" %}
                {% if products %}
                <ul class="nav-menu-child-child">
                    {% for item in products %}
                    <li><a href="{{item.Link}}">{{item.Title}}</a></li>
                    {% endfor %}
                </ul>
                {% endif %}
                {% endarchiveList %}
            </li>
            {% endfor %}
        </ul>
        {% endif %}
    </li>
    {% endfor %}
    {% endnavList %}
</ul>
  1. 在導航上顯示下拉分類,并且在分類下顯示它的下級分類,如果沒有則不顯示。如圖: image

調用代碼示例,該調用需要在后臺已經設置好二級導航的基礎上(代碼不包含css樣式控制)

<ul>
    {% navList navList with typeId=1 %}
    {%- for item in navList %}
    <li>
        <a href="{{ item.Link }}">{{item.Title}}</a>
        {%- if item.NavList %}
        <ul class="nav-menu-child">
            {%- for inner in item.NavList %}
            <li>
                <a href="{{ inner.Link }}">{{inner.Title}}</a>
                {% if inner.PageId > 0 %}
                    {% categoryList categories with parentId=inner.PageId %}
                    {% if categories %}
                    <ul>
                        {% for item in categories %}
                        <li>
                            <a href="{{ item.Link }}">{{item.Title}}</a>
                        </li>
                        {% endfor %}
                    </ul>
                    {% endif %}
                    {% endcategoryList %}
                {% endif %}
            </li>
            {% endfor %}
        </ul>
        {% endif %}
    </li>
    {% endfor %}
    {% endnavList %}
</ul>
問題反饋可加技術微信:tsrz001
目錄