How to call and display contact information configured on the back-end in the website frontend?

Calendar 👁️ 77

It is crucial to clearly and conveniently display a company's contact information in modern website operations.AnQiCMS (AnQiCMS) understands this need and provides flexible and easy-to-use backend configuration options, allowing you to dynamically display contact information on the website front-end without writing complex code.This article will introduce in detail how to configure and call these contact methods in Anqi CMS, so that your users can find you as soon as possible.


1. Configure contact information on the back-end: Source of information

All the data displayed on the front-end originates from the careful configuration on the back-end.In AnQi CMS, managing the contact information of the website is a straightforward process.You need to log in to the backend management interface and then navigate to the left menu's“Background Settings”, then clickthe "Contact Information Settings".

Here, you will find a series of preset common contact information fields, such as:

  • Contact (UserName): This is usually the name of the contact person you want to publish externally.
  • Contact Phone (Cellphone): This is the most direct way for customers to communicate with you.
  • Contact Address (Address): Convenient for customers to inspect on-site or send items.
  • Contact Email (Email): Common channels for business cooperation or detailed consultation.
  • WeChat ID (Wechat): Popular instant messaging methods at the moment.
  • WeChat QR Code (Qrcode): Convenient for users to scan and add.
  • Moreover, AnQi CMS is integrated with many social media fields such asQQ, WhatsApp, Facebook, Twitter, Tiktok, Pinterest, Linkedin, Instagram, Youtubeetc., to meet the needs of global operations and multi-channel promotion.

If these preset fields do not meet your specific needs, AnQi CMS also provides powerful"Custom Setting Parameters"Function. For example, you may need a dedicated customer service hotline or a specific business consultation QQ group number. You can add custom parameters here. Just fill in one"Parameter name"This is the key identifier called in the front-end template, it is recommended to use English), assign it accordingly“Parameter value”and add,"Remarks"Explain its purpose and it can be easily expanded. The addition of these custom parameters greatly enhances the flexibility and customization of the website contact information display.

Two, Front-end Template Core: Contact Information Tag

In the Anqi CMS template system, the contact information configured on the back-end mainly depends on a name calledcontactThe dedicated tag. This tag is designed to be very concise and efficient, able to accurately extract the corresponding data from the background according to the field name provided.

contactThe basic format of the tag is:{% contact 变量名称 with name="字段名称" %}.

  • 变量名称It is optional, if you want to assign the contact information obtained to a temporary variable for subsequent processing (for example, inifIf it exists in the condition, you can use it. If you just want to output the data directly, you can omit this part.
  • name="字段名称"Is the core part, you need to specify the field name you configured in the background "Contact Settings" here. Whether it is a preset field (such asCellphone/EmailOr your custom field (such as one you define)WhatsAppAll of this goes through itnameParameter to obtain.
  • siteIdThe parameter is generally not required to be filled in, it is mainly used in multi-site management scenarios, when you want to call contact information from a non-current site, it needs to be specified.For most single-site users, keep the default.

The Anqi CMS template engine supports syntax similar to Django, so the writing of these tags is very intuitive.

3. Example of calling the common contact information field

UnderstoodcontactAfter the usage of tags, let's take some specific examples to see how to flexibly display various contact methods on the website front-end.

1. Display the contact person's name and phone number

Generally, the footer of a website or the "Contact Us" page will display the name and phone number of the contact person.

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

Here, we use directlyname="UserName"andname="Cellphone"to obtain the contact name and phone number configured in the background and to display them.<a href="tel:...">Label, so that the phone number can be directly clicked to dial on mobile devices.

2. Show contact address and email

For the convenience of users, contact addresses and emails often appear together.

<p>公司地址:{% contact with name="Address" %}</p>
<p>电子邮箱:<a href="mailto:{% contact with name="Email" %}">{% contact with name="Email" %}</a></p>

Similarly, the email address has been addedmailto:Clicking on the link will directly open the email client

3. Show the WeChat QR code

The display of the WeChat QR code is slightly different, it needs to use<img>Tag to load the image.

<div class="wechat-qrcode">
    <p>微信扫一扫,添加好友:</p>
    {% contact wechatQrcode with name="Qrcode" %}
    {% if wechatQrcode %}
        <img src="{{ wechatQrcode }}" alt="微信二维码" />
    {% else %}
        <p>暂无微信二维码信息</p>
    {% endif %}
</div>

Here we first need toQrcodeThe value is assigned to a temporary variable.wechatQrcodeThen useifStatement to check if the variable exists. If it exists, it will go through.<img>Label display, otherwise display a prompt message. It is a good programming habit that can avoid blank or error messages when data is missing.

4. Call other social media or custom fields

Whether it is a preset social media field (such asWhatsApp) or a custom field (for example, one you added named in the back endServiceLineCustomer service hotline, the calling methods are all consistent.

<p>WhatsApp:{% contact with name="WhatsApp" %}</p>
<p>客服热线:{% contact with name="ServiceLine" %}</p>

JustnameParameters that correspond to the field names configured in the background can accurately obtain and display information.

The, Integration and Optimization: Let information be more flexible to display

Integrate the scattered contact information into a unified area and optimize it, which can make your website look more professional and provide a better user experience.

You can create an information block at the footer or a dedicated "Contact Us" page to display all contact information. To ensure the page is neat and to avoid an unattractive blank line when a contact method is not filled in, it is recommended to use a conditional statement.ifTo determine whether the information exists.

<div class="contact-info-block">
    <h4>联系我们</h4>
    <ul>
        {% contact userName with name="UserName" %}
        {% if userName %}<li>联系人:{{ userName }}</li>{% endif %}

        {% contact cellphone with name="Cellphone" %}
        {% if cellphone %}<li>电话:<a href="tel:{{ cellphone }}">{{ cellphone }}</a></li>{% endif %}

        {% contact contactEmail with name="Email" %}
        {% if contactEmail %}<li>邮箱:<a href="mailto:{{ contactEmail }}">{{ contactEmail }}</a></li>{% endif %}

        {% contact contactAddress with name="Address" %}
        {% if contactAddress %}<li>地址:{{ contactAddress }}</li>{% endif %}

        {% contact wechatId with name="Wechat" %}
        {% if wechatId %}<li>微信:{{ wechatId }}</li>{% endif %}

        {% contact whatsappId with name="WhatsApp" %}
        {% if whatsappId %}<li>WhatsApp:{{ whatsappId }}</li>{% endif %}
    </ul>

    {% contact wechatQrcode with name="Qrcode" %}
    {% if wechatQrcode %}
        <div class="wechat-qrcode-display">
            <p>微信扫码咨询:</p>
            <img src="{{ wechatQrcode }}" alt="微信二维码" />
        </div>
    {% endif %}
</div>

In this way, each contact information is first assigned to a temporary variable and then through{% if 变量名 %}To determine whether the information exists. It will only render the corresponding HTML code when it exists, which ensures the integrity of the content and avoids layout problems caused by empty data.As for the final style and layout, it can be beautified through a CSS file.

You have now mastered the technique of how to configure contact information on the Anqi CMS backend and dynamically and flexibly display it on the website front end.The design concept of AnQi CMS is to make content management simple and efficient, through these tags, you will be able to easily manage and display your key information.


Frequently Asked Questions (FAQ)

1. I have set up the contact information in the background, but it is not displayed on the front-end page, what could be the reason?First, make sure you have used the template correctly.{% contact %}the tags, andnameThe parameter fills in the field name configured on the backend (including uppercase and lowercase).Next, check if the template file has been uploaded to the server and activated.If cache was used, please try to clear the system cache of Anqi CMS.Finally, confirm that you have filled in the content for the corresponding fields in the "Contact Information Settings" on the backend.

How to call the contact information of another site in a multi-site secure CMS?Of Security CMScontactTag supportsiteIdparameter. You can use{% contact with name="FieldName" siteId="另一个站点的ID" %}Specify the contact information for calling a specific site. You can find the IDs of each site in the "Multi-site Management" section of the backend.

3. How can I call a custom contact method, such as "after-sales phone number", on the front end?Assuming you add a "parameter name" in the "Custom Settings Parameters" under the "Contact Information Settings" in the backgroundAfterSalesPhonefield. Then in the front-end template, you can use{% contact with name="AfterSalesPhone" %}Call and display its "parameter value". The calling method is exactly the same as the preset field, just make surenameThe parameter is consistent with the "parameter name" you define.

Related articles

How does AnQiCMS's scheduled publishing feature ensure that content is displayed accurately online as planned?

Today, with the increasing refinement of content operation, how to ensure that carefully prepared content is presented to readers on time and as scheduled is a challenge facing many operators.In order to coordinate with market activities, maintain update frequency, or publish information across different global time zones, manual publishing always comes with inefficiency and potential human errors.The time publishing function of AnQiCMS (AnQiCMS) was born to solve this pain point, and it has become an indispensable and powerful assistant for content operation with its efficient and automated characteristics.The core of this feature lies in 'planfulness'

2025-11-09

How to use anti-crawling and watermark management features to protect the display rights of original content?

Today, with the increasing prevalence of digital content, the value of original content becomes more and more prominent, but it also faces unprecedented risks of misuse.Hardly created articles, carefully designed images, may be collected by crawlers, copied and pasted by others in a moment, not only let the original creator's efforts go to waste, but may also affect the search engine ranking of the website, damaging the brand reputation.To effectively protect the original display rights of our website, AnQiCMS (AnQiCMS) provides a practical anti-crawling and watermark management function to help us build a solid content protection barrier.###

2025-11-09

What practical uses does the batch replacement feature for all-site content have for optimizing content display?

Operate a website, especially a website with a large amount of content, the most annoying thing is that you need to make unified adjustments to a large number of published content.Whether it is the transformation of the company's strategic direction, the upgrade of the product line, or the adjustment of the SEO keyword strategy, manually modifying hundreds or even thousands or even tens of thousands of articles one by one is not only inefficient, but also prone to omissions and errors.This not only consumes valuable human resources, but may also affect the overall image of the website and search engine performance.The "Full Station Content Bulk Replacement" feature of AnQi CMS is specifically designed to solve this pain point, making content optimization and display management unprecedentedly efficient and accurate

2025-11-09

What advanced SEO tools does AnQiCMS provide to improve a website's performance in search results?

Search engine optimization (SEO) is the key to the success of a website in today's digital world.An excellent website content management system (CMS) not only helps you efficiently organize and publish content, but should also be built-in with powerful SEO features to ensure your website has good visibility in search engine results.AnQiCMS is a platform that provides a series of advanced tools, aimed at helping your website stand out in a highly competitive online environment.First, the basic architecture of the website is crucial for SEO.AnQiCMS provides strong support for URL optimization

2025-11-09

How to configure the TDK (title, keywords, description) of the homepage to enhance SEO display effect?

When we search for a keyword in a search engine, besides the sorting of search results, the first thing that catches our eye is the title, URL, and a brief description of each result.These are the three parts that we commonly refer to as website TDK - Title, Keywords, and Description.They are like your website's 'business card' on search engines, directly affecting whether users click to enter your website and how search engines understand your website's theme.The configuration of TDK is particularly crucial for the homepage of the website

2025-11-09

How to flexibly control and display the website navigation list (multi-level navigation) in the template?

In website operation, a clear and efficient navigation system is undoubtedly the foundation of user experience and search engine optimization.A well-designed navigation can not only guide users to quickly find the information they need, but also help search engines better understand the structure of the website.In AnQiCMS, we have powerful tools to flexibly configure and display multi-level navigation lists, thereby meeting diverse website needs. ### Step 1: Flexibly configure the navigation menu in the background AnQiCMS's navigation management feature is very intuitive.First, we will set up the core menu structure in the background "navigation settings"

2025-11-09

How to filter and display the document list based on categories, models, recommended attributes, and other conditions?

Today, with the increasing refinement of content management, how to make the document list of a website flexible to display according to different needs is a core skill that every website operator needs to master.AnQiCMS (AnQiCMS) takes advantage of its powerful template tag system, providing us with an extremely convenient and efficient solution.This article will delve into how to accurately filter and display your document list in AnQiCMS based on various conditions such as categories, content models, and recommendation attributes.--- ### **Core Tool: `archiveList`

2025-11-09

How to precisely control the display of document title, introduction, content, and other elements on the article detail page?

The article detail page is the core display area of the website content, which directly affects the user's access experience and the perception of the website's professionalism.For AnQiCMS users, mastering how to finely control the display of various elements on the article detail page can not only enhance the visual appeal of the website but also optimize the user's reading path, effectively improving SEO performance.AnQiCMS as a flexible content management system provides various ways to help us accurately adjust the title, abstract, content, and other additional information presentation of the article detail page

2025-11-09