Using AnqiCMS templates.htmlAs template file suffix, and stored in/templateIn the template folder, the static resources such as styles, js scripts, images, and so on used by the template are stored separately/public/static/Directory.
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 %}.
Variable names follow camelCase naming convention, with the first letter of each word capitalized, with some exceptions, such as{archive.Id}/{archive.Title}.
The template file should be encoded in UTF8, if it is encoded in other encoding, it will cause the page to display garbled, and it will not display normally. If Windows users edit template files, please save them as template files encoded in UTF-8 format.
The supported types of templates include: adaptive template type, code adaptation template type, PC+mobile end template type.
Templates support separate mobile end template definitions, mobile end templates are stored in.mobileThe directory, when choosing the template for code adaptation mode, PC + mobile end mode, needs to be createdmobileTemplate.
The template supports some default custom names. As long as these custom template files exist, there is no need to set the template separately in the background, and the template can be automatically applied.
The supported template name situations:
- The default custom template name format of the document is:
{模型table}/{文档id}.html - The default custom template name format of the document list is:
{模型table}/list-{分类id}.html - The default custom template name format of the single page is:
page/{单页面id}.html