The use of template files is similar to the tag syntax of Django template engine, variables are defined using double curly braces, such as{{变量}}. Condition judgment, loop control and other tags are defined using single curly braces and percent signs, and they need to be terminated with an end tag, appearing in pairs, such as{% if archive.Id == 10 %}这是文档ID为10的文档{% endif %}.
There are 38 commonly used tags built into the system:
- System settings label
system
How to use: {% system variable name="field name" %}
- Contact Information Tag
contact
Use method: {% contact variable name with name="field name" %}
- Universal TDK tags
tdk
How to use: {% tdk variable name with name="field name" %}
- Navigation List Tag
navList
How to use: {% navList navs %}...{% endnavList %}
- Breadcrumb Navigation Tag
breadcrumb
Usage: {% breadcrumb crumbs with index="Home" title=true %}...{% endbreadcrumb %}
- Category List Label
categoryList
Usage method: {% categoryList categories with type="1" parentId="0" %}...{% endcategoryList %}
- Category Details Label
categoryDetail
Usage: {% categoryDetail with name="variableName" %}
- Single-page list tag
pageList
Usage: {% pageList pages %}...{% endpageList %}
- Single page detail tag
pageDetail
Usage: {% pageDetail with name="variable name" %}
- Document List Tags
archiveList
Usage method: {% archiveList variable name with categoryId="1" moduleId=1 order="id desc|views desc" type="page|list" %}...{% endarchiveList %}
- Document Details Tag
archiveDetail
How to use: {% archiveDetail with name="variable name" %}
- Previous Document Tag
prevArchive
How to use: {% prevArchive prev %}...{% endprevArchive %}
- Next Document Tag
nextArchive
How to use: {% nextArchive next %}...{% endnextArchive %}
- related document tag
archiveList
View the usage method in the document list label: {% archiveList archiveRelations with type="related" %}...{% endarchiveList %}
- document parameter tag
archiveParams
{% archiveParams params with sorted=true %}...{% endarchiveParams %}
- document parameter filter tag
archiveFilters
Usage method: {% archiveFilters params with moduleId=1 allText="All" %}...{% endarchiveFilters %}
- Document Tag List Label
tagList
How to use: {% tagList tags with type="1" limit="10" %}...{% endtagList %}
- Tag Details Label
tagDetail
Use method: {% tagDetail with name="variable name" %}
- Tag Document List Label
tagDataList
How to use: {% tagDataList archives with tagId="1" %}...{% endtagDataList %}
- Comment List Label
commentList
How to use: {% commentList comments with itemType="archive" itemId="1" type="page" %}...{% endcommentList %}
- Message Form Label
guestbook
How to use: {% guestbook fields %}...{% endguestbook %}
- Friendship Links Label
linkList
Usage method: {% linkList friendLinks %}...{% endlinkList %}
- Pagination Label
pagination
Usage method: {% pagination pages with show="5" %}...{% endpagination %}
- if logical judgment tag
if else endif
Usage method: {% if condition %} ... {% elif other conditions %} ... {% else %} ... {% endif %}
- for loop traversal tag
for empty endfor
Usage method: {% for item in archives %}...{% empty %}...{% endfor %}
- Formatted timestamp label
stampToDate
Usage method: {{stampToDate(timestamp, "format")}}.A timestamp that is 10 digits long, such as 1609470335, in the format supported by Golang.
- Define variable assignment label
with
How to use: {% with title="This is the title declared for the header" keywords="These are the keywords declared for the header" %} %} Title: {{title}}, Keywords: {{keywords}}
- Other auxiliary labels
tags
Use method: include, extends, macro, lorem
- More filters
filters
Usage method: {{obj|filter__name:param}}}