丝袜av在线观看|日本美女三级片在线播放|性欧美一区二区三区|小骚热免费国产视频|黑人va在线观看|女同国产91视频|五月丁香色播Av|国产凸凹视频一区二区|伊人电影久久99|国产成人无码一区二区观看

文檔列表標(biāo)簽

說明:用于獲取文檔常規(guī)列表、相關(guān)文檔列表、文檔分頁列表

使用方法:{% archiveList 變量名稱 with categoryId="1" order="id desc|views desc" type="page|list" q="搜索關(guān)鍵詞" %} 如將變量定義為 archives {% archiveList archives with type="page" %}...{% endarchiveList %}

archiveList 支持的參數(shù)有:

  • 模型ID moduleId moduleId 可以獲取指定文檔模型的文檔列表如 moduleId="1" 獲取文章模型的文檔列表。

  • 分類ID categoryId categoryId 可以獲取指定分類的文檔列表如 categoryId="1" 獲取文檔分類ID為1的文檔列表。多個(gè)分類ID可用,隔開,如 categoryId="1,2,3"。

    如果未指定 categoryId 它會(huì)嘗試讀取當(dāng)前頁面分類的分類ID,因此如果希望它不自動(dòng)讀取當(dāng)前分類ID,則可以通過 categoryId="0" 來指定不自動(dòng)讀取。

  • 排除的分類ID excludeCategoryId excludeCategoryId 可以排除指定分類的文檔如 excludeCategoryId="1" 排除文檔分類ID為1的文檔。多個(gè)分類ID可用,隔開

  • 作者ID userId userId 可以獲取指定用戶ID發(fā)布的文檔,如 userId="1"獲取用戶ID為1的用戶發(fā)布的文檔。

  • 推薦屬性 flag flag 支持的屬性值有 頭條[h]、推薦[c]、幻燈[f]、特薦[a]、滾動(dòng)[s]、加粗[h]、圖片[p]、跳轉(zhuǎn)[j]。如要顯示flag屬性為推薦的,則標(biāo)簽為 flag="c"

  • 排除的推薦屬性 excludeFlag excludeFlag 支持排除的屬性值有 頭條[h]、推薦[c]、幻燈[f]、特薦[a]、滾動(dòng)[s]、加粗[h]、圖片[p]、跳轉(zhuǎn)[j]。如要項(xiàng)列表不顯示指定的flag屬性的文檔,則標(biāo)簽為 excludeFlag="c"

  • 是否列出文檔的flag showFlag showFlag 支持的值有 true|false,默認(rèn)為 false。如果需要在文檔列表中顯示文檔的flag標(biāo)簽,則設(shè)置為 showFlag=true

  • 是否顯示子分類內(nèi)容 child child 支持的屬性值有 false|true,默認(rèn) true。如只想顯示屬于當(dāng)前分類的文檔,而不包括子分類的文檔,則需指定 child=false

  • 排序方式 order order 可以指定文檔顯示的排序規(guī)則,支持依據(jù) 最新文檔排序 order="id desc"、瀏覽量最多文檔排序 order="views desc"、按后臺(tái)自定義排序 order="sort desc",默認(rèn)按照自定義排序,可以不用填。

  • 顯示數(shù)量 limit limit 可以指定顯示數(shù)量,按多少數(shù)量來分頁,比如limit="10"則只會(huì)顯示10條,limit 在不是分頁列表的時(shí)候,支持offset模式,也就是 ,分隔模式,如想從第2條開始,獲取10條數(shù)據(jù),可以設(shè)置成 limit="2,10"。

  • 列表類型 type type 支持按 page、list、related 方式列出。默認(rèn)值為list,type="list" 時(shí),只會(huì)顯示 指定的 limit 指定的數(shù)量,如果type="page" 后續(xù)可用 pagination 來組織分頁顯示 {% pagination pages with show="5" %}。type 的值為 related 的情況下,支持 like 參數(shù)。 like=“keywords|relation”,默認(rèn)不需要 like 參數(shù),它自動(dòng)獲取最靠近當(dāng)前文檔的其他文檔。如果指定了 like=“keywords”,則會(huì)根據(jù)文檔第一個(gè)關(guān)鍵詞來獲取相關(guān)的文檔。如果指定了 like=“relation”,則只會(huì)展示后臺(tái)文檔編輯界面設(shè)置的相關(guān)文檔。

  • 搜索關(guān)鍵詞 q q 僅在列表類型 type="page" 時(shí)生效,可以指定搜索內(nèi)容,如果需要搜索內(nèi)容,可以通過參數(shù)q來展示指定包含關(guān)鍵詞的標(biāo)題搜索內(nèi)容如 q="seo" 呈現(xiàn)結(jié)果將只顯示標(biāo)題包含seo關(guān)鍵詞的列表。也可以不指定,如果url中存在 q=關(guān)鍵詞 的 query參數(shù),則在分頁列表中會(huì)自動(dòng)讀取 q 關(guān)鍵詞內(nèi)容并用于搜索。

  • 篩選參數(shù) 自定義 篩選參數(shù)僅在列表類型 type="page" 時(shí)生效,篩選參數(shù)僅需要放到url的query參數(shù)上。在文檔額外自動(dòng)配置中,配置了可篩選的字段,可以通過將這些字段附加到url的query參數(shù)上,來完成對(duì)文檔進(jìn)行參數(shù)是篩選。如你的文檔中設(shè)置了篩選自動(dòng)為sex,默認(rèn)值有 男,女,保密,則你可以通過url的query參數(shù)sex=男 來搜索文檔sex字段是男的文檔內(nèi)容。

  • 站點(diǎn)ID siteId siteId 一般不需要填寫,如果你使用后臺(tái)的多站點(diǎn)管理創(chuàng)建了多個(gè)站點(diǎn),并且想調(diào)用其他站點(diǎn)的數(shù)據(jù),則可以通過指定 siteId 來實(shí)現(xiàn)調(diào)用指定站點(diǎn)的數(shù)據(jù)。

  • 組合文檔ID combineId combineId 這是一個(gè)特殊字段,用于在列表中附加一個(gè)文檔,比如一篇文檔是“北京”,組合的文檔是“上?!保憧梢允褂?code>{{item.Title}}到{{combine.Title}}的旅游線路,可以實(shí)現(xiàn)“從北京到上海的旅游線路”的標(biāo)題生成,并且新鏈接也會(huì)加上組合,如北京的ID是1,上海的ID是2,則URL可能是:”/tour/1/c-2.html”。

  • 前置組合文檔ID combineFromId combineFromId 這是一個(gè)特殊字段,用于在列表中附加一個(gè)文檔,比如一篇文檔是“北京”,前置組合的文檔是“上?!?,你可以使用{{combine.Title}}到{{item.Title}}的旅游線路,可以實(shí)現(xiàn)“從上海到北京的旅游線路”的標(biāo)題生成,并且新鏈接也會(huì)加上組合,如北京的ID是1,上海的ID是2,則URL可能是:”/tour/2/c-1.html”。和combineId順序相反。

使用了 combineIdcombineFromId 后,列表中可用 {{combine.文檔字段}} 來調(diào)用組合文檔的字段內(nèi)容。在組合文檔URL下,有 {{combineArchive.文檔字段}} 可用于調(diào)用組合文檔的字段內(nèi)容。

archives 是一個(gè)數(shù)組對(duì)象,因此需要使用 for 循環(huán)來輸出

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

  • 文檔ID Id
  • 文檔標(biāo)題 Title
  • 文檔SEO標(biāo)題 SeoTitle
  • 文檔鏈接 Link
  • 文檔關(guān)鍵詞 Keywords
  • 文檔描述 Description
  • 文檔模型ID ModuleId
  • 文檔分類ID CategoryId
  • 文檔規(guī)范鏈接 CanonicalUrl
  • 文檔的用戶ID UserId
  • 價(jià)格 Price
  • 庫存 Stock
  • 文檔閱讀等級(jí) ReadLevel
  • 文檔的原文鏈接 OriginUrl
  • 文檔瀏覽量 Views
  • 文檔封面圖片 Images
  • 文檔封面首圖 Logo
  • 文檔封面縮略圖 Thumb
  • 文檔評(píng)論數(shù)量 CommentCount
  • 文檔添加時(shí)間 CreatedTime 時(shí)間戳,需要使用格式化時(shí)間戳為日期格式 {{stampToDate(item.CreatedTime, "2006-01-02")}}
  • 文檔更新時(shí)間 UpdatedTime 時(shí)間戳,需要使用格式化時(shí)間戳為日期格式 {{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
  • 文檔的Flag Flag 顯示文檔的flag屬性,需要在查詢列表時(shí),指定 showFlag=true
  • 文檔標(biāo)簽
  • 文檔模型設(shè)置的其他字段參數(shù)

代碼示例

{# list 列表展示 #}
<div>
{% archiveList archives with type="list" limit="10" %}
    {% for item in archives %}
    <li>        {#  如需判斷當(dāng)前是否是循環(huán)中的第一條,可以這么寫: #}
        {% if forloop.Counter == 1 %}這是第一條{% endif %}
        {# 比如需要給第一條添加額外class="active",可以這么寫: #}
        <a class="{% if forloop.Counter == 1 %}active{% endif %}" href="{{item.Link}}">{{item.Title}}</a>

        <span>當(dāng)前第{{ forloop.Counter }}篇,剩余{{ forloop.Revcounter}}篇</span>
        <span>文檔ID:{{item.Id}}</span>
        <span>文檔標(biāo)題:{{item.Title}}</span>
        <span>文檔鏈接:{{item.Link}}</span>
        <span>文檔關(guān)鍵詞:{{item.Keywords}}</span>
        <span>文檔描述:{{item.Description}}</span>
        <span>文檔分類ID:{{item.CategoryId}}</span>
        <span>文檔瀏覽量:{{item.Views}}</span>
        <span>文檔的Flag屬性:{{item.Flag}}</span>
        <span>文檔發(fā)布日期:{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
        <span>文檔發(fā)布月日:{{stampToDate(item.CreatedTime, "01-02")}}</span>
        <span>文檔發(fā)布時(shí)間:{{stampToDate(item.CreatedTime, "15:04:05")}}</span>
        <span>文檔發(fā)布時(shí)分:{{stampToDate(item.CreatedTime, "15:04")}}</span>
        <span>文檔發(fā)布日期時(shí)間:{{stampToDate(item.CreatedTime, "2006-01-02 15:04:05")}}</span>
        <div>封面首圖<img src="{{item.Logo}}" alt="{{item.Title}}" /></div>
        <div>封面縮略圖<img src="{{item.Thumb}}" alt="{{item.Title}}" /></div>
        封面組圖圖片
        <ul>
        {% for inner in item.Images %}
        <li>
            <img src="{{inner}}" alt="{{item.Title}}" />
        </li>
        {% endfor %}
        </ul>

        文檔標(biāo)簽:
        {% tagList tags with itemId=item.Id limit="10" %}
        {% for item in tags %}
        <a href="{{item.Link}}">{{item.Title}}</a>
        {% endfor %}
        {% endtagList %}

        文檔額外字段
        {% archiveParams params with id=item.Id %}
        <div>
            {% for item in params %}
            <div>
                <span>{{item.Name}}:</span>
                <span>{{item.Value}}</span>
            </div>
            {% endfor %}
        </div>
        {% endarchiveParams %}
    </li>
    {% empty %}
    <li>
        該列表沒有任何內(nèi)容
    </li>
    {% endfor %}
{% endarchiveList %}
</div>

列表展示文檔

{# list 列表展示 #}
<div>
{% archiveList archives with type="list" categoryId="1" limit="10" %}
    {% for item in archives %}
    <li>
        <a href="{{item.Link}}">
            <h5>{{item.Title}}</h5>
            <div>{{item.Description}}</div>
            <div>
                <span>{% categoryDetail with name="Title" id=item.CategoryId %}</span>
                <span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                <span>{{item.Views}} 閱讀</span>
            </div>
        </a>
        {% if item.Thumb %}
        <a href="{{item.Link}}">
            <img alt="{{item.Title}}" src="{{item.Thumb}}">
        </a>
        {% endif %}
    </li>
    {% empty %}
    <li>
        該列表沒有任何內(nèi)容
    </li>
    {% endfor %}
{% endarchiveList %}
</div>

展示相關(guān)文檔

{# related 相關(guān)文檔列表展示 #}
<div>
{% archiveList archives with type="related" limit="10" %}
    {% for item in archives %}
    <li>
        <a href="{{item.Link}}">
            <h5>{{item.Title}}</h5>
            <div>{{item.Description}}</div>
            <div>
                <span>{% categoryDetail with name="Title" id=item.CategoryId %}</span>
                <span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                <span>{{item.Views}} 閱讀</span>
            </div>
        </a>
        {% if item.Thumb %}
        <a href="{{item.Link}}">
            <img alt="{{item.Title}}" src="{{item.Thumb}}">
        </a>
        {% endif %}
    </li>
    {% empty %}
    <li>
        該列表沒有任何內(nèi)容
    </li>
    {% endfor %}
{% endarchiveList %}
</div>

分頁展示文檔

{# page 分頁列表展示 #}
<div>
{% archiveList archives with type="page" limit="10" %}
    {% for item in archives %}
    <li>
        <a href="{{item.Link}}">
            <h5>{{item.Title}}</h5>
            <div>{{item.Description}}</div>
            <div>
                <span>{% categoryDetail with name="Title" id=item.CategoryId %}</span>
                <span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                <span>{{item.Views}} 閱讀</span>
            </div>
        </a>
        {% if item.Thumb %}
        <a href="{{item.Link}}">
            <img alt="{{item.Title}}" src="{{item.Thumb}}">
        </a>
        {% endif %}
    </li>
    {% empty %}
    <li>
        該列表沒有任何內(nèi)容
    </li>
    {% endfor %}
{% endarchiveList %}

    {# 分頁代碼 #}
    <div >
        {% pagination pages with show="5" %}
            {# 首頁 #}
            <a class="{% if pages.FirstPage.IsCurrent %}active{% endif %}" href="{{pages.FirstPage.Link}}">{{pages.FirstPage.Name}}</a>
            {# 上一頁 #}
            {% if pages.PrevPage %}
            <a href="{{pages.PrevPage.Link}}">{{pages.PrevPage.Name}}</a>
            {% endif %}
            {# 中間多頁 #}
            {% for item in pages.Pages %}
            <a class="{% if item.IsCurrent %}active{% endif %}" href="{{item.Link}}">{{item.Name}}</a>
            {% endfor %}
            {# 下一頁 #}
            {% if pages.NextPage %}
            <a href="{{pages.NextPage.Link}}">{{pages.NextPage.Name}}</a>
            {% endif %}
            {# 尾頁 #}
            <a class="{% if pages.LastPage.IsCurrent %}active{% endif %}" href="{{pages.LastPage.Link}}">{{pages.LastPage.Name}}</a>
        {% endpagination %}
    </div>
</div>

搜索文檔分頁展示

搜索接收默認(rèn)路徑為: /search

搜索表單示例代碼:

<form method="get" action="/search">
    <div>
        <input type="text" name="q" placeholder="請(qǐng)輸入搜索關(guān)鍵詞" value="{{urlParams.q}}">
        <button type="submit">搜索</button>
    </div>
</form>

注意:這里的 q 可以不指定,而是通過瀏覽器的url的query參數(shù)來動(dòng)態(tài)獲取 如:/search?q=SEO

{# page 搜索指定關(guān)鍵詞分頁列表展示 #}
<div>
{% archiveList archives with type="page" q="seo" limit="10" %}
    {% for item in archives %}
    <li>
        <a href="{{item.Link}}">
            <h5>{{item.Title}}</h5>
            <div>{{item.Description}}</div>
            <div>
                <span>{% categoryDetail with name="Title" id=item.CategoryId %}</span>
                <span>{{stampToDate(item.CreatedTime, "2006-01-02")}}</span>
                <span>{{item.Views}} 閱讀</span>
            </div>
        </a>
        {% if item.Thumb %}
        <a href="{{item.Link}}">
            <img alt="{{item.Title}}" src="{{item.Thumb}}">
        </a>
        {% endif %}
    </li>
    {% empty %}
    <li>
        該列表沒有任何內(nèi)容
    </li>
    {% endfor %}
{% endarchiveList %}

    {# 分頁代碼 #}
    <div>
        {% pagination pages with show="5" %}
            {# 首頁 #}
            <a class="{% if pages.FirstPage.IsCurrent %}active{% endif %}" href="{{pages.FirstPage.Link}}">{{pages.FirstPage.Name}}</a>
            {# 上一頁 #}
            {% if pages.PrevPage %}
            <a href="{{pages.PrevPage.Link}}">{{pages.PrevPage.Name}}</a>
            {% endif %}
            {# 中間多頁 #}
            {% for item in pages.Pages %}
            <a class="{% if item.IsCurrent %}active{% endif %}" href="{{item.Link}}">{{item.Name}}</a>
            {% endfor %}
            {# 下一頁 #}
            {% if pages.NextPage %}
            <a href="{{pages.NextPage.Link}}">{{pages.NextPage.Name}}</a>
            {% endif %}
            {# 尾頁 #}
            <a class="{% if pages.LastPage.IsCurrent %}active{% endif %}" href="{{pages.LastPage.Link}}">{{pages.LastPage.Name}}</a>
        {% endpagination %}
    </div>
</div>

常見使用實(shí)例

  1. 在循環(huán)多個(gè)分類中顯示分類下的文檔。如圖:

image

調(diào)用代碼示例(代碼不包含css樣式控制)

{% categoryList categories with moduleId="1" parentId="0" %}
<div>
    {% for item in categories %}
    <div>
        <h3><a href="{{ item.Link }}">{{item.Title}}</a></h3>
        <ul>
            {% archiveList archives with type="list" categoryId=item.Id limit="6" %}
            {% for archive in archives %}
            <li>
                <a href="{{archive.Link}}">
                    <h5>{{archive.Title}}</h5>
                    <div>{{archive.Description}}</div>
                    <div>
                        <span>{{stampToDate(archive.CreatedTime, "2006-01-02")}}</span>
                        <span>{{archive.Views}} 閱讀</span>
                    </div>
                </a>
                {% if archive.Thumb %}
                <a href="{{archive.Link}}">
                    <img alt="{{archive.Title}}" src="{{archive.Thumb}}">
                </a>
                {% endif %}
            </li>
            {% empty %}
            <li>
                該列表沒有任何內(nèi)容
            </li>
            {% endfor %}
        {% endarchiveList %}
        </ul>
    </div>
    {% endfor %}
</div>
{% endcategoryList %}
  1. 在循環(huán)多個(gè)分類中顯示分類的下級(jí)分類,如果沒有下級(jí)分類,則顯示分類的文檔。如圖:

image

調(diào)用代碼示例(代碼不包含css樣式控制)

<div>
    {% categoryList productCategories with moduleId="2" parentId="0" %}
    {% for item in productCategories %}
    <a href="{{item.Link}}">{{item.Title}}</a>
    <ul class="ind-pro-nav-ul">
        {% if item.HasChildren %}
            {% categoryList subCategories with parentId=item.Id %}
            {% for inner in subCategories %}
            <li><a href="{{inner.Link}}" title="">{{inner.Title}}</a></li>
            {% endfor %}
            {% endcategoryList %}
        {% else %}
            {% archiveList products with type="list" categoryId=item.Id limit="8" %}
            {% for inner in products %}
            <li><a href="{{inner.Link}}" title="">{{inner.Title}}</a></li>
            {% endfor %}
            {% endarchiveList %}
        {% endif %}
    </ul>
    {% endfor %}
    {% endcategoryList %}
</div>
問題反饋可加技術(shù)微信:tsrz001
目錄