Tag Document List Tag

Description: Used to get the document list of specified tags

How to use:{% tagDataList 变量名称 with tagId="1" %}If you define a variable as archives{% tagDataList archives with tagId="1" %}...{% endtagDataList %}

The supported parameters of tagDataList are:

  • TagIDtagId
    tagIdYou can get a list of documents for the specified tag, such astagId="1"Get a list of documents with TagID 1.

    If not specifiedtagIdIt will try to read the TagID of the current Tag page.

  • Model IDmoduleId
    moduleIdYou can get a list of documents for a specified document model, such asmoduleId="1"Get a list of documents for the article model.

  • sort byorder
    orderYou can specify the sorting rules for document display, and support sorting by latest documentorder="id desc", the most views document sortingorder="views desc", custom sort by backgroundorder="sort desc", by default, sorted by custom, you don't need to fill in it.

  • Display quantitylimit
    limitYou can specify the number of displays and paging them by the number, for examplelimit="10"Only 10 items will be displayed. ,limitWhen it is not a paging list, supportoffsetMode, that is,Separation mode, if you want to get 10 pieces of data from item 2, you can set it tolimit="2,10".

  • List Typetype
    typeSupports listing by page and list. The default value is list,type="list"When the specified limit is displayed, only the specified number of limit is specified, iftype="page"Resume laterpaginationTo organize pagination display{% pagination pages with show="5" %}.

  • Pagination Tagspagination
    paginationTo organize pagination display{% pagination pages with show="5" %}.

  • Site IDsiteId
    siteIdGenerally, there is no need to fill in it. If you use the background multi-site management to create multiple sites and want to call data from other sites, you can specify itsiteIdTo implement the data calling the specified site.

archives is an array object, so it needs to be usedforLoop to output

item is a variable in the for loop body. The available fields are:

  • Document IDId
  • Document titleTitle
  • Document linkLink
  • Document keywordsKeywords
  • Document descriptionDescription
  • Document Classification IDCategoryId
  • Document view countViews
  • Document cover pictureImages
  • First image of the document coverLogo
  • Document cover thumbnailThumb
  • Number of document commentsCommentCount
  • Document addition timeCreatedTimeTime stamp, need to use formatted timestamps as date format{{stampToDate(item.CreatedTime, "2006-01-02")}}
  • Document update timeUpdatedTimeTime stamp, need to use formatted timestamps as date format{{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
  • Document tags
  • Document extra field parameters

Code Example

{# page 分页列表展示 #}
<div>
{% tagDataList 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>
        该列表没有任何内容
    </li>
    {% endfor %}
{% endtagDataList %}

    {# 分页代码 #}
    <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>