As an experienced website operations expert, I know that when managing and maintaining a website, even a small template tag problem may confuse and worry the operator. Today, let's delve into a problem that occasionally occurs in AnQiCMS (AnQi CMS) users: the use of{% contact %}Labels, but the front-end page does not display any content. Don't worry, this is usually not a big deal, just follow the steps to investigate and you will find the cause and solve it quickly.
In AnQiCMS template{% contact %}Label does not display content? Senior operation expert for you to analyze
In AnQiCMS,{% contact %}
This kind of situation where the 'label exists but the content disappears' is often caused by the following aspects:
1. Improper use of labels: The most common 'carelessness'
AnQiCMS template tag design aims to provide flexibility, but this also means there are certain requirements for usage. For{% contact %}A label does not act like a universal switch and can be directly input{% contact %}It can display all contact information at once. On the contrary, you need to clearly tell it which specific contact method you want to display.
According to the design conventions of AnQiCMS,{% contact %}the tag needs to be配合nameto specify the field name to be called. For example, if you want to display the contact phone number, the correct syntax should be{% contact with name="Cellphone" %}If you only wrote{% contact %}withoutnamethe parameter, then the template engine does not know exactly what information you want to get, and therefore cannot display any content.
Check if you have missed anythingnameOr, parameter,nameDoes the name of the field after the parameter match the system preset or the field name you have customized in the background?
The system preset field names include:UserName(Contact),Cellphone(Contact phone),Address(Contact address),Email(Contact email),Wechat(WeChat ID),Qrcode(WeChat QR code) and so on.
2. Back-end "Contact Information Settings" content is missing or mismatched
Even if your tag usage is completely correct, if the background data itself is empty, or if the field you call is not set at all in the background, then the front-end naturally cannot display it.
Please go to the AnQiCMS backend, navigate to“Backend Settings” -> “Contact Information Settings”page. Check carefully:
- Are you filling in the corresponding field (such as the field for "Contact Phone" corresponding to
Cellphone) with content?Many times, the operator may have just created the field but forgotten to assign a value to it. - If you are calling the custom contact method field, please confirm that the "parameter name" of the field matches the one in your template
nameThe value of the parameter must be completely consistent.For example, if you have customized a named "WhatsApp contact method" in the background, with the "parameter name" beingWhatsAppthen the corresponding call in the template should be{% contact with name="WhatsApp" %}. Parameter names are case-sensitive, any spelling error may cause them not to be displayed.
3. The 'trickery' of the caching mechanism.
AnQiCMS as an enterprise-level CMS, in order to improve access speed and system performance, it will inevitably introduce a caching mechanism.This means that even if you modify the contact information or template code in the background, the front-end page may not be immediately updated due to the loading of old cache data.
If the label usage and backend settings are confirmed to be correct, it is likely a cache issue.
The solution is quite simple: go to the AnQiCMS backend, click the 'Update Cache' button in the left navigation bar, and clear the system cache.After that, refresh your website's front page, and the content should usually appear.Sometimes, the browser's own cache may be at fault, and clearing the browser cache or accessing in incognito mode can be very helpful.
4. The 'Site ID' mystery in a multi-site environment
If you are using the multi-site management feature of AnQiCMS, and{% contact %}Tags are used to try to obtainother sitesIf you need to specify your contact informationsiteIdParameter.
{% contact 变量名称 with name="字段名称" siteId="X" %}
Among themXIs the ID of your target site. However, this situation is relatively rare, most of the time we are getting the contact information of the current site from the template of the current site, at this timesiteIdThe parameter can be omitted. However, if your website is a multi-site architecture and there is a need for cross-site template calls, this is indeed a factor that needs to be considered.
5. Template file loading or parsing exception
It is not very common, but if there are syntax errors in your template file itself, or if AnQiCMS encounters problems when loading or parsing the template, it may also cause some tags to be rendered incorrectly.However, if it is in this case, it is usually accompanied by more obvious error messages or layout confusion.
Solution strategy:
- Check each one by one:Always start with the simplest and most common reasons. First, check the tag syntax (
nameParameter, followed by background data, then clear the cache. - Check carefully:Especially field names, distinguish uppercase and lowercase, avoid spelling errors.
- Take small steps quickly:If you are a newly added tag, you can first test it on a blank test page or in an area that does not affect the main site.
- Check the log:If all the above methods fail, you can try to view the AnQiCMS system log (usually located in the AnQiCMS deployment directory on the server)
running.logorerror.log),may have more detailed error information.
By following these troubleshooting steps, you should be able to find{% contact %}The specific reason why the label does not display the content, and successfully solve the problem, so that the visitor can see the complete information of your website.
Frequently Asked Questions (FAQ)
Ask: I have set up a custom contact method in the background, such as 'Customer Service QQ', how do I call it in the template? Answer:In the background "Contact Information Settings", the "parameter name" you fill in for the custom field is the one in the template
nameThe value of the parameter. For example, if the parameter name of "Customer Service QQ" isServiceQQThat is called in the template{% contact with name="ServiceQQ" %}Make sure the parameter name matches with the one in the templatenameThe values must match exactly (including case).Question: Why can I write directly in the template
{% contact %}Nothing is displayed? Answer: ":{% contact %}The label needs to benameThe parameters must explicitly specify the specific contact information field you want to retrieve. For example, to display the phone number, it needs to be written as{% contact with name="Cellphone" %}. If missingnameThe parameter, the template engine does not know which field you want to retrieve, so it will be displayed as empty.Ask: I have updated the content in the background 'Contact Information Settings', but the front page is still old. What should I do? Answer:This is likely a system cache issue.Please log in to the AnQiCMS backend, click the 'Update Cache' button in the left navigation bar, and completely clear the system cache.After that, refresh your website's front page, and if the browser also has a cache, please clear it or access in incognito mode, you should be able to see the latest content usually.