Description: Used to get the single page list
Usage:{% pageList 变量名称 %}
If the variable is defined as pages{% pageList pages %}...{% endpageList %}
Parameters supported by pageList
- Site ID
siteId
siteId
Generally, it is not necessary to fill in. If you have created multiple sites using the multi-site management on the backend and want to call data from other sites, you can do so by specifyingsiteId
To implement the call to data from a specified site.
pageList This tag will retrieve all pages. If you need to exclude certain pages, you can remove the unnecessary pages in the subsequent for loop.
pages is an array object, so it needs to be usedfor
in a loop to output
item is the variable within the for loop, available fields include:
- Single-page ID
Id
- Single page title
Title
- Single page link
Link
- Single Page Description
Description
- Single Page Content
Content
- Single Page Thumbnail Large Image
Logo
- Single Page Thumbnail
Thumb
Code example
<ul>
{% pageList pages %}
{% for item in pages %}
<li>
{# 如需判断当前是否是循环中的第一条,可以这么写: #}
{% if forloop.Counter == 1 %}这是第一条{% endif %}
{# 比如需要给第一条添加额外class="active",可以这么写: #}
<a class="{% if forloop.Counter == 1 %}active{% endif %}" href="{{item.Link}}">{{item.Title}}</a>
<a href="{{ item.Link }}">{{item.Title}}</a>
<a href="{{ item.Link }}">
<span>当前第{{ forloop.Counter }}篇,剩余{{ forloop.Revcounter}}篇</span>
<span>单页ID:{{item.Id}}</span>
<span>单页名称:{{item.Title}}</span>
<span>单页链接:{{item.Link}}</span>
<span>单页描述:{{item.Description}}</span>
<span>单页内容:{{item.Content|safe}}</span>
</a>
<div>缩略图大图:<img src="{{item.Logo}}" alt="{{item.Title}}" /></div>
<div>缩略图:<img src="{{item.Thumb}}" alt="{{item.Title}}" /></div>
</li>
{% endfor %}
{% endpageList %}
</ul>
{# 排除id为1的页面 #}
{% pageList pages %}
{% for item in pages %}
{% if item.Id != 1 %}
<li>
<a href="{{ item.Link }}">{{item.Title}}</a>
<a href="{{ item.Link }}">
<span>单页ID:{{item.Id}}</span>
<span>单页名称:{{item.Title}}</span>
<span>单页链接:{{item.Link}}</span>
<span>单页描述:{{item.Description}}</span>
<span>单页内容:{{item.Content|safe}}</span>
</a>
<div>缩略图大图:<img src="{{item.Logo}}" alt="{{item.Title}}" /></div>
<div>缩略图:<img src="{{item.Thumb}}" alt="{{item.Title}}" /></div>
</li>
{% endif %}
{% endfor %}
</ul>
{% endpageList %}