Define an array in a template

How to define an array in the Anqi CMS template?

listThe filter can define an array in the template. The defined array is a[]string{}It can be traversed and the results output in subsequent operations.

Usage Instructions

listUsage of the filter:

{% set values = '["关键词1","关键词2","关键词3"]'|list %}

The string to be converted is enclosed in single or double quotes, and is used by[/]Define the beginning and end of the array, and separate keywords with English.,Keywords can be enclosed in quotes or left unquoted.

{% set values = '["安企CMS","AnQiCMS","内容管理系统","免费建站系统","免费模板",4,5]'|list %}
{% for item in values %}
<span>{{item}}</span>/
{% endfor %}
# 显示结果
安企CMS/ AnQiCMS/ 内容管理系统/ 免费建站系统/ 免费模板/ 4/ 5/

Here is an example demonstration

{% set values = '["安企CMS","AnQiCMS","内容管理系统","免费建站系统","免费模板"]'|list %}
# 显示格式:
{{values|stringformat:"%#v"}}
# 遍历输出
{% for item in values %}
<span>{{item}}</span>/
{% endfor %}
# 显示结果
安企CMS/ AnQiCMS/ 内容管理系统/ 免费建站系统/ 免费模板/