Template Tags and Usage

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 labelsystem
How to use: {% system variable name="field name" %}
  • Contact Information Tagcontact
Use method: {% contact variable name with name="field name" %}
  • Universal TDK tagstdk
How to use: {% tdk variable name with name="field name" %}
  • Navigation List TagnavList
How to use: {% navList navs %}...{% endnavList %}
  • Breadcrumb Navigation Tagbreadcrumb
Usage: {% breadcrumb crumbs with index="Home" title=true %}...{% endbreadcrumb %}
  • Category List LabelcategoryList
Usage method: {% categoryList categories with type="1" parentId="0" %}...{% endcategoryList %}
  • Category Details LabelcategoryDetail
Usage: {% categoryDetail with name="variableName" %}
  • Single-page list tagpageList
Usage: {% pageList pages %}...{% endpageList %}
  • Single page detail tagpageDetail
Usage: {% 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 TagarchiveDetail
How to use: {% archiveDetail with name="variable name" %}
  • Previous Document TagprevArchive
How to use: {% prevArchive prev %}...{% endprevArchive %}
  • Next Document TagnextArchive
How to use: {% nextArchive next %}...{% endnextArchive %}
  • related document tagarchiveList
View the usage method in the document list label: {% archiveList archiveRelations with type="related" %}...{% endarchiveList %}
  • document parameter tagarchiveParams
{% archiveParams params with sorted=true %}...{% endarchiveParams %}
  • document parameter filter tagarchiveFilters
Usage method: {% archiveFilters params with moduleId=1 allText="All" %}...{% endarchiveFilters %}
  • Document Tag List LabeltagList
How to use: {% tagList tags with type="1" limit="10" %}...{% endtagList %}
  • Tag Details LabeltagDetail
Use method: {% tagDetail with name="variable name" %}
  • Tag Document List LabeltagDataList
How to use: {% tagDataList archives with tagId="1" %}...{% endtagDataList %}
  • Comment List LabelcommentList
How to use: {% commentList comments with itemType="archive" itemId="1" type="page" %}...{% endcommentList %}
  • Message Form Labelguestbook
How to use: {% guestbook fields %}...{% endguestbook %}
  • Friendship Links LabellinkList
Usage method: {% linkList friendLinks %}...{% endlinkList %}
  • Pagination Labelpagination
Usage method: {% pagination pages with show="5" %}...{% endpagination %}
  • if logical judgment tagif else endif
Usage method: {% if condition %} ... {% elif other conditions %} ... {% else %} ... {% endif %}
  • for loop traversal tagfor empty endfor
Usage method: {% for item in archives %}...{% empty %}...{% endfor %}
  • Formatted timestamp labelstampToDate
Usage method: {{stampToDate(timestamp, "format")}}.A timestamp that is 10 digits long, such as 1609470335, in the format supported by Golang.
  • Define variable assignment labelwith
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 labelstags
Use method: include, extends, macro, lorem
  • More filtersfilters
Usage method: {{obj|filter__name:param}}}