How to obtain the contact information, phone number, email, social media, and other information configured in the background "Contact Settings"?

Calendar 👁️ 84

AnQiCMS provides a convenient function for website administrators to centrally manage and display contact information.In the contact information, phone number, email, and social media information configured in the background "Contact Information Settings", all can be flexibly presented on the website front-end through simple template tags, greatly improving the efficiency and consistency of content updates.

Understand the background "Contact Information Settings"

First, let's get familiar with the configuration location of this information in the AnQiCMS backend. You can find it in the “Backend settings".Contact information settings”Option. This module allows you to centrally manage all the contact information displayed on the website.

Here are many commonly used fields such as contact person, phone number, address, email, WeChat ID, WeChat QR code, as well as links to mainstream social media platforms such as QQ, WhatsApp, Facebook, Twitter, Tiktok, Pinterest, Linkedin, Instagram, and Youtube. What's more, if these preset fields do not meet your specific needs, the system allows you to customize according to your business requirementsAdd custom parametersFor example, you can add a 'customer service hotline' or 'business cooperation email' and other personalized fields.

This information configured in the background, its core value lies in its ability to be dynamically called, avoiding the maintenance inconvenience brought by hard coding in the template.Once the information changes, you only need to update it once in the background, and all the front-end pages referencing this information will be automatically synchronized.

Get contact information in the template

To call this information on the front-end page of the website, AnQiCMS provides a specialcontacttag. The design of this tag is simple and powerful, and its basic usage format is as follows:

{% contact 变量名称 with name="字段名称" %}

Among them,nameThe parameter is key, it corresponds to the unique identifier for each contact information field you set up in the background. If omitted变量名称part, the label will directly output the value of the field; if you specify变量名称Then this value will be assigned to this variable, you can refer to it in the subsequent template code through{{ 变量名称 }}to refer to it.

Next, we will demonstrate how to obtain these contact methods through specific examples:

to get the websiteContact Nameusually corresponds to the background'sUserNameField:

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

ObtainContact phone numberyou can useCellphonefield. To make it convenient for users to click and call, it can be combined withtel:protocol:

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

Contact addressIt will pass.Addressthe field:

<p>地址:{% contact with name="Address" %}</p>

Contact emailByEmailfield to obtain, which can also be combined withmailto:to generate clickable links via protocol:

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

ForWeChat IDYou may want to display the text directly:

<p>微信号:{% contact with name="Wechat" %}</p>

AndWeChat QR codeIt is an image link, which needs to be embedded<img>It can be displayed normally in the tag. To improve the readability of the code, we usually assign it to a variable first:

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

We added an extra one here:ifDetermine, so that when the background does not set the QR code, the page will not display an empty<img>.

AnQiCMS also built-in support for multipleSocial media informationfields.nameParameters are usually the name of the platform, for exampleFacebook/Twitter/QQ/WhatsAppetc. You can call them like this:

<p>
    关注我们:
    <a href="{% contact with name="Facebook" %}" target="_blank">Facebook</a>
    <a href="{% contact with name="Twitter" %}" target="_blank">Twitter</a>
    <a href="https://wpa.qq.com/msgrd?v=3&uin={% contact with name="QQ" %}&site=qq&menu=yes" target="_blank">QQ咨询</a>
</p>

Please note that QQ consultation links require a specific format, and an example is provided here. Other social media links are usually the URLs of the platform pages.

If you have created in the backgroundCustom parameterfor example, a namedcustomerServicePhonecustomer service phone number, you can also call it using its parameter name:

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

Actual application example

Combine the above contact methods, you can create a complete contact information area in the website footer or a dedicated "Contact Us" page:

<div class="footer-contact-info">
    <h3>联系我们</h3>
    <p>联系人:<span>{% contact with name="UserName" %}</span></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>
    <p>地址:<span>{% contact with name="Address" %}</span></p>

    {% contact wechatQrcode with name="Qrcode" %}
    {% if wechatQrcode %}
    <div class="wechat-qr-section">
        <img src="{{ wechatQrcode }}" alt="微信二维码">
        <p>扫码添加微信</p>
    </div>
    {% endif %}

    <div class="social-media-links">
        <a href="{% contact with name="Facebook" %}" target="_blank" rel="nofollow">Facebook</a>
        <a href="{% contact with name="Twitter" %}" target="_blank" rel="nofollow">Twitter</a>
        <a href="{% contact with name="Linkedin" %}" target="_blank" rel="nofollow">LinkedIn</a>
        <a href="https://wpa.qq.com/msgrd?v=3&uin={% contact with name="QQ" %}&site=qq&menu=yes" target="_blank" rel="nofollow">QQ</a>
    </div>
    <p class="copyright">版权所有 &copy; {% now "2006" %} {% system with name="SiteName" %}</p>
</div>

BycontactThe flexible use of tags, AnQiCMS makes it easy to manage and display website contact information, whether it is a regular field or custom content, it can be called in a unified way, which greatly improves the maintenance efficiency and scalability of the website.

Frequently Asked Questions (FAQ)

  1. How to add a custom contact information field in the background?In the AnQiCMS backend, go to the "Backend Settings" -> "Contact Information Settings" page.At the bottom of the page, you will see a "Custom Setting Parameters" area.Click 'Add Custom Parameter', then enter the desired 'parameter name' (this is the identifier used when calling the template, it is recommended to use English), 'parameter value' (the actual content displayed), and 'note' (used to describe the purpose of this parameter).After saving, it can be used in the template{% contact with name="你的参数名" %}to call.

  2. Why did I call the WeChat QR code, but the front-end only displays a link text instead of an image?When you use it in the template{% contact with name="Qrcode" %}When calling the WeChat QR code, it returns the URL path of the QR code image. To display the image on the front end, you need to embed this URL into the HTML's<img>label'ssrcIn the attribute, for example:<img src="{% contact with name="Qrcode" %}" alt="微信二维码">At the same time, it is recommended to add a blank image tag on the page to avoid the situation where the background has not set a QR code.if

Related articles

How to get and display the system parameters configured in the global settings of the AnQiCMS template?

In the AnQiCMS template, efficiently obtaining and displaying the system parameters configured in the background "Global Settings" is the key to ensuring unified website information and convenient management.AnQiCMS provides a set of intuitive and powerful template tags, allowing developers and operators to easily achieve this goal without delving into complex programming code.

2025-11-08

How to use the `languages` tag to build a language switch menu and output the `hreflang` tag in a multilingual site?

Building multilingual sites in AnQiCMS (AnQiCMS) can not only expand your market range but also provide a more user-friendly access experience for users in different regions.To achieve this goal, the core lies in effectively utilizing the `languages` tag to create a language switch menu and correctly output the `hreflang` tag to optimize search engine recognition.AnQiCMS is a content management system that focuses on enterprise applications, with its powerful multilingual support being one of its highlights.It allows you to create multiple language versions for website content

2025-11-08

How to dynamically output the SEO title, keywords, and description (TDK) on AnQiCMS templates?

The performance of a website in search engines directly affects the efficiency of content access, and the title (Title), keywords (Keywords), and description (Description), abbreviated as TDK, are the 'business card' for search engines to understand page content.Effectively manage and dynamically output TDK, which can significantly improve the SEO effect and click-through rate of the website.AnQiCMS is a content management system that highly values SEO and provides flexible and powerful features, making it easy to dynamically configure page TDK.

2025-11-08

If the article content is in Markdown format, how to use the `render` filter to render it as HTML?

AnQi CMS is favored by many users for its efficient and flexible content management capabilities.In content creation, Markdown format has become the preferred choice for many content creators due to its simplicity and efficiency.But how to beautifully present these Markdown-formatted contents as structured HTML on the website front-end is a concern for many users.

2025-11-08

How to dynamically build and display custom form fields for leaving messages in the template?

In website operation, the message form is an important bridge for users to interact with the website, collect user feedback, or potential customer information.A flexible and customizable feedback form can greatly enhance the practicality and user experience of a website.AnQiCMS (AnQi CMS) provides strong support in this regard, allowing users to customize message form fields in the background and dynamically build and display these fields in the front-end templates, thereby meeting various personalized business needs.### AnQiCMS留言表单的灵活性 AnQiCMS

2025-11-08

How to integrate captcha functionality in comment or message form to prevent spam?

Websites and article comments are an important bridge for interaction between websites and users, and they can effectively improve the activity and user stickiness of the content.However, these open interactive areas are often targeted by spammers, and a large amount of meaningless or malicious information not only damages the image of the website but may also affect search engine rankings.To effectively curb such problems, integrating a captcha function into the message or comment form is an effective method.A safe CMS as an efficient website building tool, fully considering common challenges in content operation and providing convenient solutions

2025-11-08

How to customize and output Json-LD structured data in AnQiCMS template to optimize search engine display?

In today's digital marketing environment, the importance of Search Engine Optimization (SEO) is self-evident, and structured data is one of the key factors for improving a website's performance on Search Engine Results Pages (SERP).AnQiCMS is a system focused on providing efficient content management solutions, which offers powerful SEO optimization tools to website operators with its flexible customization and output of Json-LD structured data in templates.

2025-11-08

How to retrieve and display detailed information about website users or user groups (such as VIP level, balance)?

In Anqi CMS, implementing the acquisition and display of detailed information of website users or user groups is a key link in building personalized member systems and enriching user experience.Whether it is to display the user's VIP level, account balance, or the name of the user group they belong to, AnQiCMS provides intuitive and powerful template tags to help us easily achieve these functions. ### Deep Understanding of AnQiCMS User and User Group System AnQiCMS is built with a complete user management and user group (VIP system) function.

2025-11-08