When using AnQiCMS for website construction and content management, ensuring that the template files are displayed correctly is the foundation for the normal operation of the website.In this case, the naming convention of template files, especially the file extension, plays a crucial role.
The template files of AnQi CMS have a clear and unified file extension requirement, that is, to use.htmlAs a template file extension. These files are usually organized and stored in the root directory of the website./templateIn the folder.
Choose.htmlAs the suffix of the template file is not accidental, it is closely related to the characteristics of the template engine adopted by AnQiCMS.The CMS supports syntax similar to Django template engine, which looks very natural in HTML files.{{变量}}显示数据,或者使用English{% if ... %}/{% for ... %}Using tags to control the display of page content. This design makes the writing and maintenance of template files intuitive, and also facilitates the quick mastery of front-end developers.
Comply with.html
The encoding format of template files needs to be paid special attention to, in addition to the file extension. In order to avoid garbled text on the page, all AnQiCMS template files must be uniformly used in English.UTF-8 encodingFor users accustomed to editing files under the Windows system, be sure to confirm that the template file has been saved in UTF-8 format.
Convert the template file to.htmlformat, not only can ensure that the system parses it correctly, but also brings many practical benefits:
- improve development efficiencyEnglish: Most modern integrated development environments (IDE) and text editors do
.htmlThe file has good support, including features such as syntax highlighting and code completion, which greatly improves the efficiency and experience of template writing. - Maintain clear structure: The template files are stored centrally.
/templatedirectory, and named with.htmlNaming,配合静态资源(如CSS、JS、图片)统一存放在/public/static/Directory management methods,使得整个网站项目结构清晰,易于管理和协作。 - Easy for version control: Standard file naming helps team members understand the purpose of the files, facilitating version control and collaborative development.
Therefore, whether you are building a new website or modifying an existing template, please make sure to use.htmlAs your AnQiCMS template file extension, and make sure the files are encoded in UTF-8, this will bring you a smooth and worry-free experience for your website operation.
Common Questions (FAQ)
Q1: Can the template files of Anqi CMS be used with suffixes other than .html, such as .htm or .tpl?A1:Do not do this. The template engine of Anqi CMS is specifically designed to parse template files ending with.htmlUse other suffixes (such as.htmor.tpl)May cause the system to fail to correctly identify and render your template, resulting in page display errors. Please always stick to using.htmlsuffix to ensure compatibility and correctness.
Q2:If I find that the web page displays garbled text, how should I investigate the template file issue?A2:Page display garbled characters is likely due to the incorrect encoding format of the template file.The AutoCMS requires all template files to be encoded in UTF-8.You can open the template file with garbled text in a text editor, check it, and save it in UTF-8 encoding format.For Windows users, this point is particularly important.
Q3:Where should I place my .html template file on the website?A3:AnQiCMS的模板文件通常应存放在网站根目录下的English/templateIn the folder. You can create subdirectories for different template sets under this folder. For example, a set named “default” will have its files placed in/template/default/The directory. The correct file path helps the system locate and load the corresponding template according to the website configuration.