Some basic agreements for template making

AnqiCMS template, use.htmlAs a template file suffix and stored in/templateIn the template folder, the static resources such as styles, js scripts, pictures used by the template are stored separately./public/static/Table of contents.

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

Variable names are based on the camel naming rule, with the capital letter of each word, except for some special regulations, such as{archive.Id},{archive.Title}.

The template file is uniformly encoded as UTF8 encoding. If it is other encodings, it will cause the page to be garbled and cannot be displayed normally. If it is a Windows user editing the template file, please store it as a UTF-8 format encoded template file.

The types supported by templates are: adaptive template type, code adaptive template type, PC+ mobile phone template type.

The template supports separate mobile template definitions, and the mobile templates are stored inmobileDirectory, when selecting a template for code adaptation mode, PC+mobile terminal mode, you need to create itmobiletemplate.

Template supports some default custom names. As long as these custom template files exist, you do not need to set the template in the background separately to automatically apply the template.

Supported template names:

  • The default custom template of the document is{模型table}/{文档id}.html
  • The default custom template for document list is{模型table}/list-{分类id}.html
  • The default custom template for single page ispage/{单页面id}.html