Tags and usage methods of templates

The template files are marked with labels similar to Django template engine, while variables are defined using double braces, such as{{变量}}. Tags such as conditional judgment, loop control, etc. are defined using single curly braces and percent signs, and need to be ended with end tags. The tags appear in pairs, such as{% if archive.Id == 10 %}这是文档ID为10的文档{% endif %}.

There are 38 common labels built into the system:

  • System Settings Tagssystem
How to use: {% system variable name with name="field name" %}
  • Contact Tagscontact
How to use: {% contact variable name with name="field name" %}
  • Universal TDK Tagtdk
How to use: {% tdk variable name with name="field name" %}
  • Navigation List TagnavList
How to use: {% navList navs %}...{% endnavList %}
  • Breadcrumb navigation tagsbreadcrumb
How to use: {% breadcrumb crumbs with index="Homepage" title=true %}...{% endbreadcrumb %}
  • Classification list tagscategoryList
How to use: {% categoryList categories with type="1" parentId="0" %}...{% endcategoryList %}
  • Category Details TagscategoryDetail
How to use: {% categoryDetail with name="Variable Name" %}
  • Single page list tagpageList
How to use: {% pageList pages %}...{% endpageList %}
  • Single page details tagpageDetail
How to use: {% pageDetail with name="Variable Name" %}
  • Document list tagsarchiveList
Usage method: {% archiveList Variable name with categoryId="1" moduleId=1 order="id desc|views desc" type="page|list" %}...{% endarchiveList %}
  • Document Details TagsarchiveDetail
How to use: {% archiveDetail with name="Variable Name" %}
  • Previous document tagprevArchive
How to use: {% prevArchive prev %}...{% endprevArchive %}
  • Next document tagsnextArchive
How to use: {% nextArchive next %}...{% endnextArchive %}
  • Related Document TagsarchiveList
Use method, refer to the document list tag: {% archiveList archiveRelations with type="related" %}...{% endarchiveList %}
  • Document parameter tagsarchiveParams
{% archiveParams params with sorted=true %}...{% endarchiveParams %}
  • Document parameter filter tagsarchiveFilters
How to use: {% archiveFilters params with moduleId=1 allText="all" %}...{% endarchiveFilters %}
  • Document Tag List TagtagList
How to use: {% tagList tags with type="1" limit="10" %}...{% endtagList %}
  • Tag details tagtagDetail
How to use: {% tagDetail with name="Variable Name" %}
  • Tag Document List TagtagDataList
How to use: {% tagDataList archives with tagId="1" %}...{% endtagDataList %}
  • Comment list tagcommentList
How to use: {% commentList comments with itemType="archive" itemId="1" type="page" %}...{% endcommentList %}
  • Message form tagsguestbook
How to use: {% guestbook fields %}...{% endguestbook %}
  • Friendly link tagslinkList
How to use: {% linkList friendLinks %}...{% endlinkList %}
  • Pagination Tagspagination
How to use: {% pagination pages with show="5" %}...{% endpagination %}
  • if logical judgment tagif else endif
How to use: {% if condition %} ... {% elif other conditions %} ... {% else %} ... {% endif %}
  • for loop traversal tagsfor empty endfor
How to use: {% for item in archives %}...{% empty %}...{% endfor %}
  • Format timestamp tagsstampToDate
How to use: {{stampToDate(timestamp, "format")}}. The time stamp is 10 bits, such as 1609470335, the format is a format supported by Golang.
  • Define variable assignment tagswith
Usage method: {% with title="This is the title declared for the header" keywords="This is the keywords declared for the header" %} %}Title: {{title}}, keywords: {{keywords}}
  • Other auxiliary tagstags
How to use: include, extends, macro, lorem
  • More filtersfilters
How to use: {{obj|filter__name:param}}