How to customize new parameters in the AnQiCMS backend settings and display them in the front-end template?

Calendar 👁️ 80

In AnQi CMS, in order to meet the needs of website customization and flexible content display, you can easily customize new parameters and call these parameters to display in the front-end template.This greatly enhances the website's customization capabilities, whether it's to display specific contact information, additional attributes of articles, or special configurations of a single page, it can handle it with ease.

AnQi CMS provides two main ways of custom parameters:Global parameters at the system/contact levelandCustom fields at the content model level. Understand these two methods and their applicable scenarios, which will help you better manage and display website content.

1. Understand the parameter customization capability of Anqi CMS.

The parameter customization capability of Anqi CMS is mainly reflected in two levels:

  1. Global and contact information parameters:These parameters are usually general information within the scope of the website, such as company name, filing number, contact phone number, etc., or some fixed text that needs to be repeated on multiple pages.They are set once in the background and can be called in any front-end template after that.
  2. Content Model Custom Field:These parameters are bound to specific content types (such as articles, products, single pages, categories, etc.)For example, you may need to add fields such as "Product Model", "Color Options", etc. to the "Product" model, and fields such as "Author Introduction", "Source Website", etc. to the "Article" model.These fields only appear when editing the corresponding content item and are called on the detail page or list of the content item.

Below, we will explain in detail how to set these parameters in the background, as well as how to call and display them in the frontend template.

Second, create custom parameters in the background.

1. Set global and contact information parameters

Global and contact information parameters are configured in the system settings in the background.

  • Path:Log in to the AnQi CMS backend, navigate to the left menu of the系统设置.

    • ForGlobal Parameters(such as website name, copyright information, custom website auxiliary links, etc.), please select全局功能设置.
    • ForContact Information Parameters(such as company fax, WhatsApp link, etc.), please select联系方式设置.
  • Operation steps:

    1. In全局功能设置or联系方式设置Page, you will see some built-in parameters. Below that, there is a自定义设置参数area.
    2. Click新增button.
    3. Enter the following information in the pop-up dialog box:
      • Parameter name:This is the name used when calling this parameter in the front-end template. It is recommended to use meaningful English words, and the system will automatically convert it to camel case (for example, if you entercompany faxThe system may process it asCompanyFaxPlease remember this name, it will be the key for your front-end calls.
      • Parameter value:Enter the actual content you want to display on the front-end. This can be text, numbers, links, or even HTML code snippets.
      • Note:Provide a brief description of the parameter function for future management and understanding.
    4. Click确定Save.

For example, if you want to display a customer service hotline in the footer but there is no such item in the built-in parameters, you can go to联系方式设置of自定义设置参数to add:

  • Parameter name: CustomerServiceHotline
  • Parameter value: 400-123-4567
  • Note: 客服热线电话

2. Set custom fields of the content model

The content model custom field allows you to add unique data fields for content types such as articles, products, etc.

  • Path:Log in to the AnQi CMS backend, navigate to the left menu of the内容管理-u003e内容模型.
  • Operation steps:
    1. Select the content model you want to add a custom field to (for example, "article model" or "product model"), click the编辑button.
    2. Scroll down to the内容模型自定义字段area.
    3. Click新增字段button.
    4. Enter the following information in the pop-up dialog box:
      • Parameter name:This is the Chinese name displayed to the editor when editing content in the background (for example, "article source").
      • Call field:This is the English variable name used when calling this field in the front-end template. Please use English lowercase letters and ensure uniqueness (for examplesourceUrl)
      • Field type:Choose the field suitable for your data type, such as单行文本(for short text)多行文本(for long text)数字/单项选择/多项选择/下拉选择etc. Different types will have different input controls when edited in the background.
      • Mandatory?:Set whether this field is required based on need.
      • Default:Set a default value for this field, which will be displayed if it is not filled in during editing.For selection type fields (radio, checkbox, dropdown), the options are entered here, one per line.
    5. Click确定Save the field.
    6. After saving, don't forget to click the bottom of the model editing page.确定Button to save all changes to the model configuration.

Now, when you add or edit articles/products under the content model, in其他参数Within the collapsed box, you will see the new custom fields added.

3. Call and display in the front-end template.

The template engine of AnQiCMS is similar to Django syntax, using{{变量}}To output variable content.

1. Call global and contact information parameters.

For global and custom parameters set in contact information, you cansystemandcontacttags to call.

  • invoke global parameters:Use{% system with name="您的参数名" %}. If you add a parameter named全局功能设置inCustomerServiceHotlineCustom parameter, you can call it like this in the template:

    <p>客服热线:{% system with name="CustomerServiceHotline" %}</p>
    

    Or, you can also assign it to a variable and use it:

    {% system hotline with name="CustomerServiceHotline" %}
    <p>客服热线:{{ hotline }}</p>
    
  • Call contact information parameter:Use{% contact with name="您的参数名" %}. If you add a parameter named联系方式设置inWhatsAppCustom parameter, you can call it like this in the template:

    <p>WhatsApp联系方式:{% contact with name="WhatsApp" %}</p>
    

    Similarly, you can also assign it to a variable:

    {% contact whatsappNum with name="WhatsApp" %}
    <p>WhatsApp联系方式:{{ whatsappNum }}</p>
    

2. Call the content model custom field

The call to the content model custom field is usually performed in the detail page templates of articles, products, categories, or single pages.

  • Invoke a single custom field:UsearchiveDetail(Article/Product),categoryDetailOr (category)pageDetail(Single page) tag and specifynamefor your调用字段.调用字段WithsourceUrlfield in the article details

Related articles

How to define macro functions in templates to reuse commonly used content display code snippets?

In the development of website content management system templates, we often encounter situations where we need to repeatedly write the same or similar code snippets to display specific types of content.For example, each article card in the blog article list, each product feature item on the product detail page, although their content is different, their structure and style are highly similar.If you copy and paste this code manually every time, not only is it inefficient, but you also have to repeat the laborious work in multiple places when you need to make modifications, which is very prone to errors.AnQiCMS (AnQiCMS) is an efficient content management system, its template engine supports similar

2025-11-09

How can you reference and overwrite the base master template (extends) in a template to unify the display style?

In the world of AnQiCMS, building a website with a unified appearance, easy to manage, and efficient to update is a common pursuit of each content operator and developer.Imagine if each page of the website needed to be designed individually for the header, footer, and sidebar, then the amount of work required to modify the logo, navigation menu, or copyright information would be enormous.Luckyly, AnQiCMS cleverly utilizes the template inheritance mechanism, allowing us to easily achieve a unified display style while maintaining flexible content updates

2025-11-09

How to prevent HTML tags from being automatically escaped when content is displayed?

When using Anqi CMS to manage website content, you may encounter a seemingly small but annoying problem: the formatted HTML code entered in the background editor is displayed as plain text on the front page, even presented directly in the form of angle brackets, losing the original style and layout.This not only affects the appearance of the page, but also discounts the carefully arranged content.Why is that, and how should we solve it?###

2025-11-09

How to implement the automatic display of content collected on the website front end?

How to automatically display the collected content on the website front-end is a concern for many content operators.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that provides a complete solution from content entry to front-end display.It goes through a powerful content model, flexible template tags, and a friendly SEO mechanism, making this process simple and efficient.Next, we will explore how to use the various functions of AnQiCMS to automatically and beautifully display the valuable content you collect on the website's front-end.###

2025-11-09

How to implement unified content management and front-end display for AnQiCMS?

In the digital age, many enterprises and content operations teams need to manage multiple websites, which may involve different brands, product lines, regions, or multilingual content.The traditional approach often means deploying multiple independent CMS systems, leading to high maintenance costs, repeated content updates, and difficult data integration.How to achieve unified management of content across multiple sites and efficient front-end display in the face of such challenges has become an urgent problem to be solved.AnQiCMS (AnQi Content Management System) is precisely in this context, providing users with a simple and powerful solution. AnQiCMS

2025-11-09

How can you customize the display layout of different types of content using a flexible content model?

In website operation, we often encounter such a need: different types of content require different display methods.The layout of a news article may be very different from that of a product detail page, and a team member introduction page may have its own unique style.The flexible content model of AnQiCMS (AnQiCMS) is designed to address this pain point, allowing us to deeply customize the structure of the content and the final display layout, thereby providing a ** browsing experience for visitors.### Understanding the Core Value of Content Modeling One of the Core Advantages of AnQi CMS

2025-11-09

How does the AnQiCMS website support the switching of multilingual content and accurate display?

Today, with the deepening of globalization, the international promotion of website content has become an important topic for many enterprises and operators.How can different language users smoothly browse your website and obtain the necessary information, which is the key to improving user experience and expanding the global market.AnQiCMS, as an efficient and flexible content management system, provides a powerful and practical multilingual solution in this regard. ### AnQiCMS's Multilingual Ability: Opening the Door to the Global Market One of the core strengths of AnQiCMS is its comprehensive "multilingual support" feature.This means

2025-11-09

How do static rules affect the display of website URLs and optimize search engine inclusion?

In website operation, the URL plays a more important role than many people imagine.It is not only the address when the user visits the page, but also a key link for search engines to understand and evaluate the content of the web page.Today, let's delve into how pseudo-static rules affect the display of website URLs and the significant help they bring in optimizing search engine inclusion.Why do website URLs need 'pseudo-static'? Imagine, when you see two links on the search engine results page: `www.example.com/article.php

2025-11-09