As an experienced CMS website operation personnel of AnQi, I fully understand the importance of being able to flexibly call system configuration information when building and maintaining an efficient and beautiful website.This information, such as the website name, Logo, filing number, etc., is an indispensable part of the website brand identity and basic operation.Strong and intuitive template tags provided by Anq CMS, allowing you to easily obtain and display these system-level configuration information in website templates.
The core to obtain the website system configuration:systemTag
In the AnQiCMS template system,{% system %}The tag is a tool specifically used to obtain the system configuration information of a website.It allows you to call the background "Global Feature Settings" configured data by specifying parameter names.This includes not only the basic information of the website, but also the specific parameters you may customize.
UsesystemThe basic syntax of tags is:{% system 变量名称 with name="字段名称" %}Wherein, 'field name' is the English identifier for the specific configuration item. If you do not need to assign the obtained value to a variable, you can use it directly{% system with name="字段名称" %}Please output the result directly.
Display and acquisition of the website name.
The website name is the facade of the website. It usually appears in multiple places such as the webpage title, header, footer, etc. ThroughsystemLabel, you can easily insert it dynamically into any position in the template. The 'Website Name' configured in the background 'Global Function Settings' corresponds toSiteNamefield.
For example, to display the website name in your template, you can use it like thissystemTags:
{# 直接输出网站名称 #}
<div>网站名称:{% system with name="SiteName" %}</div>
{# 将网站名称赋值给一个变量后输出 #}
{% system siteNameVariable with name="SiteName" %}
<div>网站名称(通过变量获取):{{ siteNameVariable }}</div>
This way, no matter how you modify the website name in the background, the front-end page will automatically synchronize the update without modifying the template file, greatly improving maintenance efficiency.
The acquisition and application of the website logo
The website logo is also a core element of brand recognition. In AnQiCMS, you can upload the website logo on the backend and use it tosystemThe tag retrieves its URL address in the template and applies it to<img>the tag. The "website logo" configured in the background corresponds toSiteLogofield.
Here is an example of how to retrieve and display the website logo in a template:
{# 直接输出Logo图片 #}
<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
{# 将Logo的URL赋值给变量后输出 #}
{% system siteLogoUrl with name="SiteLogo" %}
<img src="{{ siteLogoUrl }}" alt="网站Logo" />
It is worth noting that we usually use both at the same time:SiteNameasaltThe value of the attribute, which not only helps SEO, but also improves the accessibility of the website.
Other common system configuration information
In addition to the website name and Logo, AnQiCMS'ssystemThe tag provides various practical configuration information for you to call:
- Website filing number (
SiteIcp): Often used in the footer, linking to the filing query website.<p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p> - Copyright content (
SiteCopyright)Footers are usually used to display copyright statements for the website.<div>{% system with name="SiteCopyright" %}</div> - The home page address (
BaseUrl)It retrieves the root URL of the website, which is convenient for building absolute links.<a href="{% system with name="BaseUrl" %}">返回首页</a> - Static file address of the template (
TemplateUrl)Used to refer to CSS, JavaScript, and other static resources, make sure the path is correct.<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet"> - Site language (
Language)For examplezh-CNoren-US, can be used to set<html>label'slangThe attribute helps browsers and search engines understand the language of the page content.<html lang="{% system with name='Language' %}"> - Custom parameterIn the background "Global Feature Settings", you can add custom parameter names and values. For example, you added a parameter named
HelpUrlwith the value of"https://www.example.com/help<div>帮助页面链接:{% system with name="HelpUrl" %}</div>
Under a multi-site environmentsiteIdParameter
For AnQiCMS users managing multiple sites,systemthe tag also provides asiteIdThe parameter is usually not required to be filled in manually, as it defaults to automatically obtaining the configuration information of the current site. However, if you need to call it in a template of a specific site,other sitessystem configuration information (for example, displaying a child site's Logo on a main station page), then you can specifysiteIdto achieve.
for example, get the ID of2site's website name:
{% system otherSiteName with name="SiteName" siteId="2" %}
<div>其他站点的名称:{{ otherSiteName }}</div>
Summary
Of Security CMS{% system %}
Frequently Asked Questions (FAQ)
1. Why do I use{% system with name="SiteLogo" %}After the tag, the front-end does not display the Logo image?
First, make sure you have uploaded and saved the website logo in the "Global Function Settings" of the AnQiCMS background. Secondly, check your template code to ensure<img>label'ssrcThe attribute has correctly used this tag and<img>The tag itself is not hidden by CSS or the path is overwritten by other errors. If you are using a multi-site mode and calling the Logo of another site, please confirm that it is used correctlysiteIdParameters. Finally, clear the browser cache and AnQiCMS system cache and try again.
2. I added a custom parameter in the background "Global Function Settings", for exampleContactEmailbut it was called in the template{% system with name="ContactEmail" %}but no content was displayed, what went wrong?
Please check the custom parameters you set in the background参数名field is consistent with the templatenameThe value matches completely. AnQiCMS template tags are case-sensitive, soContactEmailandcontactEmailthey will be considered as different fields. Additionally, make sure the custom parameters'参数值Not empty and saved. Similarly, try to clear the AnQiCMS system cache and browser cache.
3.{% system %}in the labelSiteIcpandSiteCopyrightWhere is the field usually used on the website?
SiteIcp(Website filing number) andSiteCopyrightCopyright content is usually used in the footer area of the website.The record number usually includes a link to the MIIT record query website to meet legal requirements; copyright information is used to declare the copyright of the website content.This helps enhance the professionalism and compliance of the website.