How does AnQiCMS template call the contact parameters of the background custom settings?

Calendar 👁️ 75

In website operation, a clear and effective contact method is the bridge for users to communicate with us, and it is also an important basis for building trust.For users who use AnQiCMS to manage websites, how to flexibly call the contact information parameters set in the background in website templates is the key to improving operational efficiency and website maintainability.AnQiCMS powerful background customization features, combined with its intuitive template tags, making everything easy.

Data source: Background "Contact Settings"

When using AnQiCMS, you will find that all website basic information can be easily managed in the background. Specifically for contact information, you just need to go to the background of the “Backend settingsMenu, clickContact information settingsAs soon as

Here, AnQiCMS provides a series of built-in common contact information fields, such as: contact person, phone number, contact address, contact email, WeChat ID, WeChat QR code, as well as international social media links such as QQ, WhatsApp, Facebook, etc.You just need to fill in your information in the corresponding input box, and the system will automatically save it.

What's even better is that if these default options cannot fully meet your business needs, AnQiCMS also allows you toCustom settings parameters.For example, your business may need to display a link to an uncommon instant messaging tool or a special customer service hotline.You can add a parameter in the custom parameter area, for example, set the 'Parameter Name' to 'CustomerServiceHotline', and enter the specific number in the 'Parameter Value'.The "parameter name" is the key identifier to be called in the template, and the "parameter value" is the specific information displayed on the website.This highly customized ability ensures that your website can perfectly adapt to various complex business scenarios.

Template call: Display backend settings on the website front end

AnQiCMS's template system adopts a concise syntax similar to Django, which is very intuitive. When you need to display the contact information set in the background on the website front end, you will mainly use a name calledcontactThe template tag.

The format of using this tag is usually{% contact 变量名称 with name="字段名称" %}. Among them,变量名称It is optional, used to temporarily store the data obtained, convenient for you to repeat it in the subsequent part of the template; andname="字段名称"It is the specific parameter name defined in the background "Contact Information Settings" (whether built-in or custom).

For example, to call the contact phone number set in the background, you can write it like this:

电话: {% contact with name="Cellphone" %}

If you want to call the contact email set in the background, you can do it like this:

邮箱: {% contact with name="Email" %}

And for the WhatsApp contact method we just customized, if its parameter name is "WhatsApp", you can also call it in the following way:

WhatsApp: {% contact with name="WhatsApp" %}

You can also choose to assign the obtained value to a variable, for example{% contact myPhone with name="Cellphone" %}Then you can go through{{ myPhone }}Call this phone number. This method is very convenient when you need to process the data or refer to it multiple times.

{% contact myPhone with name="Cellphone" %}
我们的热线电话是: {{ myPhone }},欢迎随时拨打。

Moreover, if you are managing multiple sites and need to call the contact information of a specific site,contactTags also supportsiteIdparameters, for example{% contact with name="Cellphone" siteId="2" %}This will call the contact phone number of the site with ID 2. This provides great convenience for multi-site operations.

Application: Contact information display layout

In website design, contact information is usually located in the header, footer, a dedicated "Contact Us" page, or in sidebars of certain specific content. Below is an example of how to flexibly use these labels to display multiple contact details:

<div class="footer-contact-info">
    <h4>联系我们</h4>
    <p>联系人: {% contact with name="UserName" %}</p>
    <p>电话: <a href="tel:{% contact with name='Cellphone' %}">{% contact with name='Cellphone' %}</a></p>
    <p>邮箱: <a href="mailto:{% contact with name='Email' %}">{% contact with name='Email' %}</a></p>
    {% set whatsappNum = contact with name='WhatsApp' %} {# 假设后台有自定义WhatsApp参数 #}
    {% if whatsappNum %}
        <p>WhatsApp: <a href="https://wa.me/{{ whatsappNum }}" target="_blank" rel="nofollow">{{ whatsappNum }}</a></p>
    {% endif %}
    <p>地址: {% contact with name='Address' %}</p>
    {% set wechatQrcode = contact with name='Qrcode' %}
    {% if wechatQrcode %}
        <p>微信扫一扫:</p>
        <img src="{{ wechatQrcode }}" alt="微信二维码" style="width: 100px; height: 100px;">
    {% endif %}
    <p>版权所有 © {% now "2006" %} {% system with name="SiteName" %}. All Rights Reserved.</p>
</div>

In this example, we used{% if %}To label certain optional fields (such as WhatsApp and WeChat QR codes) for content existence, only display when there is content, in order to avoid empty lines or unnecessary placeholders on the page, and maintain the website's neat and professional appearance. At the same time, we also add the corresponding for phone and email.tel:andmailto:Link, convenient for users to click to dial or send an email directly.

Summary

Through the flexible "Contact Settings" function of the AnQiCMS backend, combined with the concise template ofcontactLabel, you can easily display various contact information anywhere on the website.Whether it is updating the phone number, email, or adding a new social media account, there is no need to modify the template code, just a simple operation in the background can be completed, which greatly enhances the management efficiency and flexibility of the website content.This design concept makes AnQiCMS a powerful assistant for small and medium-sized enterprises and content operation teams.


Frequently Asked Questions (FAQ)

1. What will be displayed in the template if I do not fill in a field in the background "Contact Information Settings"?

Answer: If a field is not filled in the background, it will not be displayed at this location when called in the template (i.e., it will be empty).This means that AnQiCMS will intelligently handle empty values, so you don't have to worry about placeholders like 'Phone not set' appearing on the page, maintaining the cleanliness of the website.{% if ... %}and{% else %}to achieve.

Can you display contact information for different sites on a single page?

Answer: Of course you can.contactTag supportsiteIdParameter. If you have enabled the multi-site management feature in the AnQiCMS backend and created multiple sites, you can specify to{% contact with name="Cellphone" siteId="站点的ID" %}the form, specify the

Related articles

How to set the scheduled publication function in AnQiCMS to control the display time of content?

Today, with the increasing refinement of content operation, how to manage content release efficiently and strategically is an important issue facing every website operator.AnQiCMS knows this very well and has provided a powerful scheduling publication feature to help users accurately control the timing of content going live, thereby achieving a more intelligent and automated operation.This feature not only allows you to maintain the rhythm of your website content publishing, but also effectively reduces the daily operation pressure, allowing you to focus more on the quality of the content itself.### Easily control the content release rhythm

2025-11-08

How does AnQiCMS display website traffic statistics and crawler scraping information?

During the operation of a website, a comprehensive understanding of the website's access situation and interaction with search engines is the key to improving website performance.AnQiCMS (AnQiCMS) understands this point and therefore provides a set of built-in traffic statistics and crawler monitoring functions to help us intuitively grasp the operation status of the website, thereby making more intelligent operational decisions.In the AnQiCMS backend management interface, this data is concentrated in the "Data Statistics" function module.

2025-11-08

How to set image watermark in AnQiCMS to protect the display of original content?

In the era of content is king, protecting the copyright of original works becomes increasingly important, especially for image content on websites.AnQiCMS (AnQiCMS) understands this and provides content creators with image watermarking features to help them effectively maintain their original rights while displaying beautiful images. ### Easily Protect Original Content: A Practical Guide to Setting Image Watermarks in AnQiCMS When your meticulously crafted images are spread across the internet, adding watermarks is undoubtedly one of the most direct and effective ways to make a copyright declaration.

2025-11-08

How to display data of custom content models (such as products, events) in AnQiCMS?

Manage and display custom content models in Anqi CMS, such as product lists, event details, etc., which is a reflection of its powerful flexibility.The design philosophy of AnQi CMS aims to allow users to highly customize the content structure according to their own business needs and present these structured data in a直观, rich manner on the website front-end. ### The Foundation of Flexible Content Models Firstly, we need to understand the "Flexible Content Model" feature of Anqi CMS. It allows you to go beyond the traditional 'article' category, creating content types with unique fields. For example

2025-11-08

How to accurately remove extra blank lines and newline characters generated by logical tags in the AnQi CMS template?

When developing website templates, especially when using systems like AnQiCMS that are based on Django template engine syntax, a common problem is logical tags (such as `{% if ...`)}] %}` or `{% for ...After processing, sometimes unnecessary blank lines or newline characters may remain.These seemingly insignificant blanks may affect the final generated HTML structure, and even in some cases cause minor interference to the front-end style layout.

2025-11-08

In Anqi CMS template, what is the specific function of the symbols `{%-` and `-%}`, and what common layout problems can they avoid?

In Anqi CMS template development, we often strive for the beauty of the page and the neatness of the code.Sometimes, we may encounter some 'hidden' layout issues, such as unnecessary blank lines between page elements, or the HTML source code is filled with excessive whitespace.These issues may not always be apparent in the browser, but they can make our code redundant, and even cause actual errors in certain scenarios sensitive to whitespace (such as generating XML or CSV files).Fortunately, the AnQi CMS template engine provides a very practical solution

2025-11-08

How to use the `trim` filter of AnQi CMS to batch clean up spaces and newline characters at both ends of article content?

In the daily content operation of Anqi CMS, the neatness and consistency of content are the key to improving user experience and website professionalism.Sometimes, when editing or importing article content, some extra spaces or line breaks may be inadvertently introduced. These seemingly minor details may affect the layout of the content and even cause slight interference with the crawling and parsing of search engines in some cases.Luckyly, Anqi CMS's powerful template engine provides a rich set of filters, among which the `trim` filter is a powerful assistant for solving such problems

2025-11-08

What are the differences and application scenarios of the `trimLeft` and `trimRight` filters in AnQi CMS when processing leading/trailing spaces in strings?

During the operation and template creation of website content, we often encounter situations where we need to deal with extra spaces or specific characters in strings.These seemingly minor details actually relate to the neatness of the content, user experience, and even the SEO effect.AnQi CMS as an efficient content management system, deeply understands these needs, and provides a powerful and flexible string filter, especially `trimLeft` and `trimRight`, which can help us accurately control the leading and trailing parts of the string.###

2025-11-08