In the daily operation of Anqi CMS, we often need to adjust the appearance and layout of the website, which usually involves switching or enabling different templates. Anqi CMS provides an intuitive and efficient way to manage the enable status of templates, which is mainly through each template directory underconfig.jsonin the filestatusto implement the field.
config.jsonFile: Template Identity Declaration
Each Anqi CMS template has a dedicated configuration file namedconfig.jsonIt is located in the root directory of the template (for example,/template/your_template_name/config.jsonThis file is like the 'ID card' of the template, recording all the basic information and configuration parameters of the template. In addition to the template name, version, author, and other metadata, config.jsonIt contains a crucial fieldstatusIt directly determines the current status of the template
statusField: The template's enable switch
statusThe field is the key to activating the template. It accepts two optional integer values:
0(Disabled):WhenstatusThe value is0When, it indicates that the template is currently disabled. Although it exists in the system, it will not be loaded and rendered on the website front-end.1(In use):WhenstatusThe value is1When, it indicates that the template is the one currently being used by the website. Anqi CMS will load and parse this template when rendering the front-end page.
Here is a very important principle that needs to be remembered:In Anqi CMS, there can only be one template at any time:statusThe value is set to1. This is a mandatory constraint in system design, ensuring that only one clear template is always activated on the website front-end, thus avoiding potential conflicts and inconsistencies.
How to pass throughconfig.jsonEnable template
To enable a template, you need to go to the server'stemplatedirectory, find the folder of the target template. Open the folder within theconfig.jsonfiles to edit.
For example, assuming you want to enable a template named "my_new_template", you need to perform the following steps:
- Navigate to
/template/my_new_template/Directory. - Open.
config.jsonfile. - Find
statusfield and change its value from0is modified to1. - Important reminder: Before setting a new template's
statusis set to1you must ensure (or the CMS system will forcibly ensure) that the other templates currently being usedstatushave already been set to0. If you are manually editing the file, please make sure to set the old template firststatusto0, then set the new template to1, to follow the principle of 'only one template can be used at a time.' - Save
config.jsonfile. - To ensure that the system can recognize and load new template configurations in a timely manner, it is recommended that you perform a "update cache" operation in the Anqi CMS backend to clear old cache data.
After completing these steps, your website's frontend will start usingmy_new_templateto display content.
How to deactivate the template
The process of deactivating the template is simpler, just need to change theconfig.jsonin the filestatusfield value from1back to0Of course. Before disabling the currently used template, you need to ensure that another template has been successfully enabled (i.e., itsstatusThe value of1), otherwise the website front-end will not display normally.
Byconfig.jsonin the filestatusThe field, AnQi CMS provides a clear and controllable template management mechanism for website operators, making the switching and maintenance of templates efficient and orderly.
Frequently Asked Questions (FAQ)
1. If I accidentally edit manuallyconfig.jsonfile, will multiple templates bestatusset to1how will AnQi CMS handle it?
The AnQi CMS system strictly requires that only one template is in use at any given time. If you manually editconfig.jsonthe file, it may accidentally set multiple templatesstatusto the same value1The system will select a template based on its internal logic to load as the active template, usually choosing the first one it scans that is set to1The template, or follow other established priority rules. To avoid unpredictable behavior, it is strongly recommended that you switch templates through the "Website Template Management" function of the Anqi CMS backend, as the backend interface will automatically handle this uniqueness constraint to ensure that only one template is activated.
2. Besides direct modificationconfig.jsonFile, can I enable or disable the template through the Anq CMS backend management interface?
Yes, Anqi CMS provides a convenient backend management interface for enabling and disabling templates.Under the "Template Design" menu in the background, there is usually a function entry such as "Website Template Management" or something similar.Through this interface, you can directly see all the installed templates and their current status, and you can safely click the button to switch to the active template.Background operations will automatically manageconfig.jsonin the filestatusField, and ensure that only one template is set to "In Use", which is safer and more convenient than manually editing files.
3. I modifiedconfig.jsonofstatusField has been saved, but the website front-end did not update to the new template immediately, why is that?
Before modifyingconfig.jsonAfter the file, if the website front-end does not immediately display the new template, there may be several reasons.First, the Anqi CMS system usually uses caching to improve performance.You may need to perform an "update cache" operation in the background to ensure the system loads the latest configuration.Next, check if you have saved it correctlyconfig.jsonfile, and the new template'sstatusvalue is indeed for1while ensuring other templates'statusis no longer1. The cache of the server's Nginx or Apache web server may also need to be refreshed.If the problem still exists, checking the server logs usually provides more detailed error information.