Single page list tag

Description: Used to obtain a single page list

How to use:{% pageList 变量名称 %}If you define a variable as pages{% pageList pages %}...{% endpageList %}

Parameters supported by pageList

  • 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.

pageList This tag will get all pages. If you need to exclude certain pages, you can remove unwanted pages in the subsequent for loop.

pages 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:

  • Single page IDId
  • Single page titleTitle
  • Single page linkLink
  • Single page descriptionDescription
  • Single page contentContent
  • Single page thumbnail imageLogo
  • Single page thumbnailThumb

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 %}