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:
TagID
tagId
tagId
You can get a list of documents for the specified tag, such astagId="1"
Get a list of documents with TagID 1.If not specified
tagId
It will try to read the TagID of the current Tag page.Model ID
moduleId
moduleId
You can get a list of documents for a specified document model, such asmoduleId="1"
Get a list of documents for the article model.sort by
order
order
You 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 quantity
limit
limit
You can specify the number of displays and paging them by the number, for examplelimit="10"
Only 10 items will be displayed. ,limit
When it is not a paging list, supportoffset
Mode, that is,
Separation mode, if you want to get 10 pieces of data from item 2, you can set it tolimit="2,10"
.List Type
type
type
Supports 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 laterpagination
To organize pagination display{% pagination pages with show="5" %}
.Pagination Tags
pagination
pagination
To organize pagination display{% pagination pages with show="5" %}
.Site ID
siteId
siteId
Generally, 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 itsiteId
To implement the data calling the specified site.
archives is an array object, so it needs to be usedfor
Loop to output
item is a variable in the for loop body. The available fields are:
- Document ID
Id
- Document title
Title
- Document link
Link
- Document keywords
Keywords
- Document description
Description
- Document Classification ID
CategoryId
- Document view count
Views
- Document cover picture
Images
- First image of the document cover
Logo
- Document cover thumbnail
Thumb
- Number of document comments
CommentCount
- Document addition time
CreatedTime
Time stamp, need to use formatted timestamps as date format{{stampToDate(item.CreatedTime, "2006-01-02")}}
- Document update time
UpdatedTime
Time 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>