How to dynamically display the contact information of the website in AnQiCMS templates?

Calendar 👁️ 73

In website operation, clearly and accurately displaying the contact information of the website is a key link in building trust with users and providing support.A contact method that is easy to find and keep updated, which can not only improve the user experience but also help users find you quickly when necessary.AnQiCMS as an efficient content management system provides a very flexible and intuitive way for you to dynamically display and manage this important information in your website templates.

Backend settings: centrally manage your contact information

When using AnQiCMS to manage website content, the first thing is to get familiar with the 'Contact Information Settings' function. It is locatedunder the 'Background Settings' menu, there is a 'Contact Information Settings' optionItem. This is the hub for you to manage all the external contact information of the website.

Enter this interface, you will see some commonly used default settings items, such as contacts, phone numbers, contact addresses, contact email, WeChat ID and WeChat QR code, etc.These fields are designed to meet the basic needs of most websites, and you can fill them out one by one according to the actual situation.For example, enter your customer service hotline in the 'Contact Phone' field, and enter your business email address in the 'Contact Email' field.

If these default fields do not fully meet your needs, AnQiCMS also provides a powerful function for custom settings parameters.For example, you may want to display WhatsApp contact information on your website, or social media links such as Facebook, Twitter, etc.At this point, you just need to click 'Add Custom Parameter', then:

  • Parameter Name: This is the 'code' you use when calling this parameter in the template. To maintain code conventions and readability, it is recommended to use the English camelCase naming convention, for example, if you want to add WhatsApp, you can name itWhatsApp.
  • Parameter valueHere you can fill in the actual content of this contact information, such as your WhatsApp number or social media homepage link.
  • NoteThis field is only used for backend management, you can briefly describe the purpose of this parameter for future reference and maintenance.

After completing the entry of all contact information and adding custom parameters, please be sure to click Save to ensure that your changes take effect.

Called in the template: Make the contact information come alive.

Once the contact information on the backend is set up, the next task is to dynamically display them in the website's front-end template.AnQiCMS uses a syntax similar to the Django template engine, which makes it very intuitive to call data in templates.You will mainly use a name calledcontacttags.

contactThe basic usage of tags is:{% contact 变量名称 with name="字段名称" %}In which, the 'variable name' is an optional parameter, if you do not set it, the label will directly output the value of the corresponding field;If you set it, you can store the value in a variable for repeated reference in the template later.The key is innameThe value is the 'field name' you set in the background (including default field names and 'parameter names' for custom parameters).

Here are some common application examples:

1. Display contact information:

You can display your contact number using this tag in the footer or on the 'Contact Us' page and wrap it in<a>the tag for easy dialing by the user.

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

2. Display contact email:

Similarly, the email can be displayed in this way and addedmailto:Link, so that the user can click to send the email.

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

3. Display the company address:

If your company has a physical address, it is usually placed in the footer or contact page.

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

4. Display WeChat QR code:

For situations where images need to be displayed (such as WeChat QR code),contactThe tag will directly output the image URL, you can use it as<img>label'ssrcProperty.

<div class="wechat-qrcode">
    <img src="{% contact with name="Qrcode" %}" alt="微信二维码" />
    <p>扫码关注我们</p>
</div>

5. Display the custom WhatsApp contact information:

If you have customized a name in the backgroundWhatsAppThe parameter, you can call it like this in the template.

<li>WhatsApp:<a href="https://wa.me/{% contact with name="WhatsApp" %}" target="_blank">{% contact with name="WhatsApp" %}</a></li>

6. Calling in multi-site scenarios:

If you are using the multi-site management feature of AnQiCMS and want to callother sitesYou can use the contact information,siteIdSpecify the site ID with parameters. For example, the contact phone number of a site with ID 2:

<li>其他站点电话:{% contact with name="Cellphone" siteId="2" %}</li>

In most cases, you do not need to specify in the template of the current site.siteIdThe system will automatically retrieve the contact information of the current site.

Further thinking and practice.

After displaying the contact information dynamically, you can place it in the most suitable position according to the website design and user habits. Common practices include:

  • Website Header (Header):Generally, place the most critical contact phone number or social media icon.
  • Website Footer (Footer):Display complete contact information, such as address, phone, email, and registration number.
  • “Contact Us” independent pageThis is a special page that can display all contact methods in detail, including maps, online forms, etc., and introduce the contact channels with detailed text.

Through AnQiCMS's flexible template tags and backend settings, you can easily implement unified management and dynamic display of website contact information, which not only improves operational efficiency but also provides users with a more convenient communication channel.


Frequently Asked Questions (FAQ)

Q1: Why did I set the contact information in the background, but it did not display on the website front template?

A1: First, check if you clicked the save button on the "Contact Information Settings" page in the background. Second, make sure to call it in the template.contacttags in the template,nameThe value of the property is exactly the same as the 'field name' (or 'parameter name' of the custom parameter) set in the background, including case.If it still does not display, it may be a template cache problem. You can try to manually clear the cache in the 'Update Cache' feature of the AnQiCMS backend.

Q2: How to add social media contact information other than phone and email, such as WhatsApp or Facebook links?

A2: AnQiCMS' contact information settings support custom parameters. You just need to click 'Add Custom Parameter' in the background, then set a 'parameter name' (such asWhatsAppFill in the corresponding number or link in the "Parameter Value". Then, you can call it in the template through{% contact with name="WhatsApp" %}this way.

Q3: How can I ensure that each website displays its own separate contact information if I manage multiple websites?

A3: AnQiCMS supports multi-site management. After you have configured independent contact information for each site, it can be called in the corresponding site templatecontactWhen a tag is used, the system will default to reading the contact information of the current site, no additional settings are required. If you need to call a contact number from a templatefrom a non-current siteYou can use the contact information,siteIdparameters, for example{% contact with name="Cellphone" siteId="2" %}to specify the contact number of the site with the call ID of 2.

Related articles

How to correctly call and display the system configuration information in AnQiCMS templates?

Manage website content in AnQiCMS, it is not just to publish articles and products, but also includes the basic information, contact information, SEO metadata and other system-level configurations of the website.These configuration information is usually required to be displayed correctly on all pages of the website, such as displaying the website logo and name in the page header, displaying the copyright and filing number in the footer, or displaying the company's phone number and address on the contact us page.Properly and flexibly invoking these system configurations is the key to ensuring consistency, ease of maintenance, and SEO-friendliness of the website.AnQiCMS uses syntax similar to the Django template engine

2025-11-08

How to display common website elements, such as headers and footers, uniformly through template fragments (partial)?

When managing website content in Anqi CMS, you may find that many pages have similar structures, such as top navigation, footer copyright information, sidebar, or metadata tags, etc.If you have to write this code repeatedly for each page, it is not only inefficient, but also once you need to modify it, you have to search and update it page by page, which takes time and is prone to errors.Fortunately, Anqi CMS provides a very elegant solution - **template fragments (Partial)**, which helps us manage these common elements efficiently and uniformly.###

2025-11-08

How to customize the display template for specific documents, categories, or single pages?

When using AnQiCMS to manage website content, we often need to assign unique display styles and functional layouts to specific content types or unique pages.This kind of requirement is very common in content operation, for example, a product introduction page may need richer picture display and parameter comparison, while a news article focuses on the reading experience of text;Or it is the "About Us" page on the website, which needs to show a unique corporate culture.AnQi CMS provides flexible template customization features, allowing you to easily meet these personalized display needs

2025-11-08

How to choose the appropriate template type for the AnQiCMS website to optimize cross-device display effects?

It is crucial to ensure that the website displays well on different devices when building and operating a modern website.A website that provides a smooth experience on all screen sizes has become a norm as users access websites through various devices such as smartphones, tablets, and computers, not only improving user satisfaction but also helping to effectively disseminate content and optimize search engine rankings.AnQiCMS (AnQiCMS) offers various template types to meet this need, helping us flexibly deal with cross-device display challenges.

2025-11-08

How to set and display search engine friendly TDK (Title, Description, Keywords) for AnQiCMS pages?

Search engine optimization (SEO) is an indispensable part of website operation, and the Title (title), Description (description), and Keywords (keywords) - abbreviated as TDK - of the website page are the foundation of SEO.They are the first step for search engines to understand page content and a key factor for users to decide whether to click on search results.

2025-11-08

How to implement a multi-level menu and content联动 display on the AnQiCMS website navigation list?

The website's navigation system is like the skeleton of a building, it not only guides users to browse but also directly affects the exposure of content and search engine optimization.AnQiCMS provides a flexible and powerful navigation management function, allowing you to easily build multi-level menus and achieve deep linkage with website content, thereby enhancing user experience and content distribution efficiency. ### Flexible configuration, build a multi-level navigation skeleton The starting point of implementing a multi-level menu in AnQiCMS is the navigation settings in the background.You can find all configuration items related to website navigation under the 'Background Settings' and 'Navigation Settings' first.

2025-11-08

How to display the title, category, time, and other core information on the AnQiCMS document detail page?

Manage website content in AnQiCMS, the document detail page is undoubtedly the core interface for users to obtain information.How to make this page both beautiful and informative is a concern for many website operators.Today, let's talk about how to elegantly display the title, category, publication time, and other key information on the document detail page of AnQiCMS.AnQiCMS uses a syntax similar to the Django template engine, which makes it very intuitive to call various data when customizing templates.

2025-11-08

How to filter and display a specific content list based on the 'recommended properties' of the document?

How to effectively organize and display a large amount of content when operating a website is the key to improving user experience and content value.AnQiCMS provides a very practical feature, that is, to refine the management and filtering of content lists through 'recommended attributes'.This not only makes the website content more dynamic, but also helps visitors find the information they are interested in more quickly.### Understanding "Recommended Properties": A Tool for Content Organization In Anqi CMS, when we publish or edit documents, we will find an option called "Recommended Properties"

2025-11-08