How to control the enable status of the template through the `status` field in `config.`?

Calendar 👁️ 61

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:

  1. Navigate to/template/my_new_template/Directory.
  2. Open.config.jsonfile.
  3. Findstatusfield and change its value from0is modified to1.
  4. Important reminder: Before setting a new template'sstatusis 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.'
  5. Saveconfig.jsonfile.
  6. 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.

Related articles

What are the possible values and their meanings for the `template_type` field in `config.`?

As an experienced CMS website operation personnel, I fully understand the importance of template configuration for the front-end display and user experience of the website.The `config.` file is the core configuration file for each AnQiCMS template, defining its various basic properties and behaviors.Among them, the `template_type` field plays a crucial role, directly affecting the display of the website on different devices.

2025-11-06

How to define a new template, what is the role of the `config.` file?

As an experienced CMS website operation personnel, I am well aware that a flexible and efficient template system is crucial for the presentation of website content and user experience.The AnQi CMS was designed with full consideration of the customizability and ease of use of the templates, allowing both beginners and experienced developers to easily handle it.Next, I will elaborate on how to define a new template in Anqi CMS and deeply analyze the core role played by the `config.` file in this process.

2025-11-06

How to create and apply an independent template for a specific single page (such as 'About Us')?

As an experienced website operator who deeply understands the operation of AnQiCMS, I understand that you want to create and apply an independent template for a specific single page (such as "About Us").This not only allows the page content to be displayed more personalized, but also effectively meets specific design and functional requirements.AnQiCMS provides a flexible template mechanism, making this process intuitive and efficient.### A detailed guide to creating and applying independent templates for specific single pages in AnQiCMS AnQiCMS is known for its high customizability and flexibility

2025-11-06

How to customize the document list template for a specific category?

As a website operator who deeply understands the operation of AnQiCMS, I understand your needs for personalized content display and user experience optimization.The document list template under the custom category is the key step to achieve this goal.AnQiCMS provides a flexible template mechanism that allows you to present a unique list layout based on the content features of specific categories.

2025-11-06

How should common code snippets like headers, footers, etc. be organized and stored during template creation?

As a website operator familiar with Anqi CMS, I am well aware of the importance of a well-structured and easy-to-maintain template for the long-term healthy operation of the website.How to efficiently organize and store common page headers, footers, and other reusable code snippets during template creation is crucial for improving development efficiency and ensuring website consistency.In Anqi CMS, the template system uses a syntax similar to the Django template engine, which provides us with powerful tools to achieve code reuse and modular management.

2025-11-06

How to create and reference reusable code snippets like sidebars, breadcrumbs, etc. in templates?

As an experienced CMS website operation person in a security company, I am well aware of the importance of efficient content management and flexible template customization for website operation.In daily work, we often need to deal with various page elements, such as sidebars, breadcrumb navigation, headers, and footers, etc., which appear repeatedly on multiple pages.It is crucial to modularize and reuse these commonly used code snippets in order to improve development efficiency, ensure code consistency, and simplify maintenance work.AnQi CMS provides a powerful and easy-to-use template engine, allowing us to easily achieve this goal.

2025-11-06

What should the default naming of the homepage template file be?

As an experienced CMS website operation personnel, I fully understand the importance of the homepage in attracting and retaining users. It is the first impression of users visiting the website and also the core hub of content layout and information communication.For Anqi CMS, understanding the naming conventions of its template files, especially the default naming of the homepage template file, is the foundation for ensuring the smooth operation and efficient management of the website.The Anqi CMS system defaults to identifying the homepage template file as `index.html`.This file is the entry point of your current theme template

2025-11-06

What is the default naming rule for the template files of the model home page, document detail page, and document list page?

As an experienced CMS website operation personnel of an enterprise security, I know that a clear and efficient template naming rule is crucial for the management of website content and user experience.AnQi CMS provides great flexibility in template design and also establishes a set of default naming conventions, which is very helpful for us to quickly build and iterate web pages.In AnQi CMS, all template files are named with a `.html` extension and are uniformly stored in the `/template` folder under the system root directory.

2025-11-06