How to call the contact information set in the background of AnQiCMS template?

Calendar 👁️ 53

As an experienced senior personnel proficient in Anqing CMS content operation, I know that the efficiency of website information management is crucial for attracting and retaining users.Especially contact information such as this basic yet critical information, its unified management and flexible use is the foundation for improving operational efficiency and ensuring the accuracy of information.Below, I will give a detailed introduction on how to call the contact information set in the AnQiCMS template.


Unified management of contact information in AnQiCMS backend

In AnQiCMS, the contact information of the website is centrally managed, which greatly simplifies the content update process.You do not need to modify the template file to quickly update the phone, address, and email information of the website.These settings are located under the 'Contact Settings' option in the 'Background Settings' menu.

On this interface, AnQiCMS provides many default contact information fields, such as contact person (UserName), phone number (Cellphone), contact address (Address), contact email (Email), WeChat ID (Wechat) and WeChat QR code (Qrcodeetc.In addition, to meet the personalized needs of different websites, AnQiCMS also supports custom settings parameters.You only need to provide a "parameter name" (for template calls, it is recommended to use letters and follow camel case naming), a "parameter value", and a "note" to identify its purpose, and you can easily expand the contact information field.

In this way, website operators can manage all external contact information in one place, ensure consistency of the entire site data, and quickly take effect when updates are needed, avoiding omissions and errors that may occur when manually modifying multiple template files.

Contact information is called in AnQiCMS template

AnQiCMS template engine adopts a syntax structure similar to Django, variable output uses double curly brackets{{变量}}where logical control uses single curly braces and the percent sign{% 标签 %}The contact information set in the background depends mainly on the built-incontact.

contactThe design principle of the tag is to simply and efficiently obtain the contact information configured in the background. Its basic usage method is{% contact 变量名称 with name="字段名称" %}.Where,“field name”is the identifier of the corresponding field in the background“contact information settings”.If you choose to provide a 'variable name', the value of this field will be assigned to this variable for subsequent use in the template; if no 'variable name' is specified, the tag will output the value of the field directly.

Here are specific examples of calling each contact information field:

Calling contact information

If you want to display the contact name set in the background in the template, you can use the following method:

<span>联系人:{% contact with name="UserName" %}</span>

Or, if you want to assign the value to a variable and then use it:

{% contact agentName with name="UserName" %}
<span>联系人:{{agentName}}</span>

Call the contact phone number

To display the contact phone number, you willnameset the attribute toCellphone:

<span>联系电话:{% contact with name="Cellphone" %}</span>

On mobile, you can also wrap it intel:the link for easy clicking and dialing:

<a href="tel:{% contact with name="Cellphone" %}" rel="nofollow">联系电话:{% contact with name="Cellphone" %}</a>

Call contact address

For the physical address of a company or store, useAddressField:

<span>联系地址:{% contact with name="Address" %}</span>

Call the contact email

Display the company's external email address,nameThe attribute should beEmail:

<span>联系邮箱:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></span>

Call WeChat number and WeChat QR code

For WeChat information, you can call WeChat number text and QR code image separately:

<span>微信号:{% contact with name="Wechat" %}</span>
<div class="wechat-qrcode">
    <img src="{% contact with name="Qrcode" %}" alt="微信二维码" />
</div>

Call other built-in social media contact methods

AnQiCMS also includes contact fields for social media platforms such as QQ, WhatsApp, Facebook, Twitter, Tiktok, Pinterest, Linkedin, Instagram, and Youtube.You can set it in the background as needed and call it according to the corresponding field name.

<span>WhatsApp:{% contact with name="WhatsApp" %}</span>

Call custom settings parameters

If you have added custom parameters in the "Contact Information Settings" backend, for example, you have created a namedServiceHotlineThe parameter is used to display the 24-hour service hotline, you can call it like this in the template:

<span>24小时服务热线:{% contact with name="ServiceHotline" %}</span>

Please note, here,ServiceHotlineShould match the parameter name set in the background when you customize the parameters and follow the camel case naming rule set in the background.

Example of practical application scenarios

Integrate this contact information into the website footer, "Contact Us" page, or header, which is a common application method. For example, a typical website footer may contain the following contact information:

<footer>
    <div class="contact-info">
        <p>联系人:{% contact with name="UserName" %}</p>
        <p>电话:<a href="tel:{% contact with name="Cellphone" %}" rel="nofollow">{% contact with name="Cellphone" %}</a></p>
        <p>邮箱:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></p>
        <p>地址:{% contact with name="Address" %}</p>
        <div class="social-links">
            {% contact wechatAccount with name="Wechat" %}
            {% if wechatAccount %}
            <span>微信:{{wechatAccount}}</span>
            {% endif %}

            {% contact whatsappLink with name="WhatsApp" %}
            {% if whatsappLink %}
            <a href="{{whatsappLink}}" target="_blank" rel="noopener noreferrer">WhatsApp</a>
            {% endif %}
            
            <img src="{% contact with name="Qrcode" %}" alt="微信二维码" style="width: 80px; height: 80px;" />
        </div>
    </div>
    <div class="copyright">
        &copy; {% now "2006" %} 版权所有 {% system with name="SiteName" %}
    </div>
</footer>

This example demonstrates how to flexibly combinecontactlabels to display various contact methods. Use{% if %}labels can determine whether certain optional fields exist, avoiding displaying empty content when not set.

Summary

Provided by AnQiCMScontactLabel, website operators can easily dynamically call the contact information set in the background on the website template.This centralized management and flexible call mechanism not only improves the efficiency of information updates but also ensures the accuracy and consistency of the website's external information.Whether it is a standard contact field or a customized extension information, AnQiCMS can provide powerful and convenient support to help your website operate more efficiently and professionally.


Frequently Asked Questions (FAQ)

1. What will be displayed in the template if a contact information field is empty in the background?

Answer: If a field in the background "Contact Information Settings" is empty, then in the template through{% contact with name="字段名称" %}When invoked, this position will output an empty string. To avoid unnecessary whitespace or tags on the page, it is recommended that you use these optional fields when calling them.{% if %}Logic to determine if there is any content, for example:

{% contact phoneNum with name="Cellphone" %}
{% if phoneNum %}
    <p>联系电话:{{phoneNum}}</p>
{% endif %}

2. How to call the contact information field that I customized in the background?

Answer: Any field you customize in the "Contact Information Settings" backend can be called using the "parameter name{% contact with name="ServiceEmail" %}Call its value. Make sure the 'parameter name' you use matches the uppercase and lowercase settings on the back-end, following camelCase naming conventions.

3. Can I call the contact information of other sites if my AnQiCMS is deployed with multiple sites?

Yes, the multi-site management function of AnQiCMS supports you to call the contact information of other sites.contactTags provide asiteIdParameter, you can obtain the contact information of other sites by specifying their ID. For example, if you want to call the phone number of a site with ID 2, you can use{% contact with name="Cellphone" siteId="2" %}. If not specifiedsiteIdThe parameter, the tag will default to getting the contact information of the current site.

Related articles

How to get and display the website name and logo in AnQiCMS template?

As an experienced CMS website operation personnel of an enterprise, I am well aware of the importance of effectively displaying brand information in templates for user experience and brand recognition.The following article will provide a detailed guide on how to obtain and display the website name and logo in the AnQiCMS template.In AnQiCMS template, a practical guide to obtaining and displaying the website name and LogoThe website's name and logo are the core visual elements of the brand

2025-11-06

What template engine syntax does AnQiCMS template support, and what are the formats of its variables and tags?

As an experienced AnQiCMS website operations personnel, I am well aware of the importance of an efficient and easy-to-use template system for website content management and user experience.AnQi CMS does an excellent job in this aspect, providing a powerful and flexible template mechanism that makes content presentation intuitive and highly customizable.Now, let's delve deeper into the syntax, variables, and tag formats supported by the AnQiCMS template.

2025-11-06

How to use a custom template for specific documents, categories, or single pages in AnQiCMS?

As an experienced AnQiCMS (AnQiCMS) website operations personnel, I am well aware of the importance of content in attracting and retaining users, and the flexible template system is the key to achieving personalized content display.AnQiCMS provides powerful custom template features, allowing operation personnel to create unique page layouts and styles according to different content needs.### AnQiCMS Template Working Principle Overview AnQiCMS template system is based on Go language and adopts syntax similar to Django template engine, files are in the form of `

2025-11-06

What is the default naming rule for single page detail page templates in AnQiCMS?

As an experienced CMS website operator for an enterprise, I am well aware that the exquisite presentation of content lies in the flexible application of templates.AnQiCMS as an efficient and customizable content management system provides us with powerful tools to shape every detail of the website, including the layout and style of single-page detail pages.Understanding the template naming rules is the foundation for efficiently managing and optimizing website content.

2025-11-06

How to dynamically set the content of the `<title>`, `<meta keywords>`, and `<meta description>` tags for AnQiCMS pages?

As an experienced security CMS website operator, I know that website SEO optimization is the core work to attract and retain users, and to enhance the visibility of the website.It is crucial to accurately set the <title>, <meta keywords>, and <meta description> tags for each page (collectively known as TDK, i.e., Title, Description, Keywords).The AnQi CMS was designed with SEO-friendliness in mind from the outset

2025-11-06

How to build a multi-level navigation menu in AnQiCMS template?

Hello, I am the familiar Anqi CMS website operation veteran that you know.Navigation menus are of great importance in daily website maintenance and content optimization, as they are not only guides for users to browse the website but also crucial for search engines to understand the website structure.Today, let's delve into how to build a flexible and efficient multi-level navigation menu in the AnQiCMS template.

2025-11-06

How to generate breadcrumb navigation path in AnQiCMS templates?

As an experienced CMS website operation personnel, I am well aware of the importance of a clear and efficient website navigation system for user experience and search engine optimization (SEO).Breadcrumbs navigation is an important part of website auxiliary navigation, which can intuitively show the user's position on the website and provide a convenient return path.The AnQi CMS with its flexible template engine makes it easy and efficient to generate breadcrumb navigation in website templates.

2025-11-06

How to list category information in AnQiCMS templates by module or parent relationship?

A detailed guide to listing category information by module or parent relationship in AnQiCMS templates As an experienced AnQiCMS website operator, I know the importance of content organization.A clear, easy-to-navigate classification system not only improves user experience, but is also the foundation of SEO optimization.AnQi CMS, with its flexible content model and powerful template tag system, provides us with multiple ways to display category information in website templates according to module or parent-child relationship.This article will delve into how to make use of these features to build an efficient classification list.###

2025-11-06