Directory and Template of Template Creation

The root directory of AnqiCMS templates is/template, each set of templates needs to be in/templateCreate your own template directory and add in the template directory.config.jsonA configuration file is used to specify some information about the template.

config.jsonThe content format of the file is:


{
	"name": "默认模板",
	"package": "default",
	"version": "1.0",
	"description": "系统默认模板",
	"author": "kandaoni.com",
	"homepage": "https://www.kandaoni.com",
	"created": "2022-05-10 22:29:00",
	"template_type": 0,
	"status": 0,
}

config.jsonThe fields are all optional. If none are filled, the system will generate them based on the actual situation. The field descriptions are as follows:

  • nameTemplate name, name according to the actual situation
  • packageTemplate folder, only supports letters and numbers, please enter the name of your template folder.
  • versionVersion of the template, custom
  • descriptionDescription of the template
  • authorTemplate author
  • homepageWebsite of the template author
  • createdTemplate creation time, format:2022-05-10 22:29:00
  • template_typeTemplate type, optional values: 0 Adaptive; 1 Code adaptation; 2 Computer + Mobile
  • statusTemplate usage status, optional values: 0 - Disabled, 1 - In use. Only one set of templates can be used in all templates.statusThe value is 1

The template directory and file support 2 modes


Folder organization mode

  • Common codebash.htmlFor example, page headers, footers, and other parts that are inherited by each page are placed here for reference.
  • Code snippet directorypartial/[en]For example, snippets like sidebars, breadcrumbs, and others are stored here
  • [en]Home Pageindex/index.html
  • [en]Model Home Page{模型table}/index.html
  • [en]Document Details Page{模型table}/detail.html {模型table}/detail-{文档ID}.html
  • [en]Document List Page{模型table}/list.html {模型table}/list-{文档分类ID}.html
  • Comments List Pagecomment/list.html
  • Online Message Pageguestbook/index.html
  • Single Page Detail Pagepage/detail.html page/detail-{单页ID}.html
  • Search Pagesearch/index.html
  • Tag Home Pagetag/index.html
  • Label document list pagetag/list.html
  • 404 error pageerrors/404.html
  • 500 error pageerrors/500.html
  • Site closed prompt pageerrors/close.html
  • Mobile template directorymobile/The directory structure and template files in the mobile template directory are consistent with the above, just repeat them.


Flat file organization mode

  • Common codebash.htmlFor example, page headers, footers, and other parts that are inherited by each page are placed here for reference.
  • Code snippet directorypartial/[en]For example, snippets like sidebars, breadcrumbs, and others are stored here
  • [en]Home Pageindex.html
  • [en]Model Home Page{模型table}_index.html
  • [en]Document Details Page{模型table}_detail.html
  • [en]Document List Page{模型table}_list.html
  • Comments List Pagecomment_list.html
  • Online Message Pageguestbook.html
  • Single Page Detail Pagepage.html page-{单页ID}.html
  • Search Pagesearch.html
  • Tag Home Pagetag_index.html
  • Label document list pagetag_list.html
  • 404 error pageerrors_404.html
  • 500 error pageerrors_500.html
  • Site closed prompt pageerrors_close.html
  • Mobile template directorymobile/The directory structure and template files in the mobile template directory are consistent with the above, just repeat them.

At the same time, some templates also support custom names, such as document details, category pages, and single pages. You can add other filenames to handle different categories and pages that require different templates. If you need to关于我们This single page, if using an independent template, can name the template aspage/about.html, and create a call for a custom template in the background aspage/about.htmlthe About Us page.