Template Creation Directory and Template

The root directory of AnqiCMS template is/templateEach set of templates needs to be in/templateCreate your own template directory and add it in the template directoryconfig.jsonConfiguration file to describe 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 in, the system will generate according to the actual situation, and 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.
  • versionTemplate version, customizable
  • descriptionTemplate introduction
  • authorTemplate author
  • homepageTemplate author's website
  • createdTemplate creation time, formatted as: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.statusValue is 1

Template directory and file support 2 modes


Folder organization mode

  • Public codebash.htmlFor example, the header, footer, and other parts inherited by each page are placed here for reference.
  • Code snippet catalogpartial/For example, the sidebar, breadcrumb, and other code snippets are stored here.
  • Homeindex/index.html
  • Model homepage{模型table}/index.html
  • Document detail page{模型table}/detail.html {模型table}/detail-{文档ID}.html
  • Document list page{模型table}/list.html {模型table}/list-{文档分类ID}.html
  • Comment list pagecomment/list.html
  • Online留言页guestbook/index.html
  • a single page detail pagepage/detail.html page/detail-{单页ID}.html
  • Search Pagesearch/index.html
  • Tag homepagetag/index.html
  • Tag 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, repeat them as needed.


Flat file organization mode

  • Public codebash.htmlFor example, the header, footer, and other parts inherited by each page are placed here for reference.
  • Code snippet catalogpartial/For example, the sidebar, breadcrumb, and other code snippets are stored here.
  • Homeindex.html
  • Model homepage{模型table}_index.html
  • Document detail page{模型table}_detail.html
  • Document list page{模型table}_list.html
  • Comment list pagecomment_list.html
  • Online留言页guestbook.html
  • a single page detail pagepage.html page-{单页ID}.html
  • Search Pagesearch.html
  • Tag homepagetag_index.html
  • Tag 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, repeat them as needed.

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