In Anqi CMS, the basic information of the page, such as the website name, Logo, record number, copyright information, etc., is an important element that constitutes the overall style and professionalism of the website.This information often requires unified management and flexible invocation at various corners of the website.systemLabel, it's like a central control panel that allows us to easily call and display these global configuration information.
UnderstandingsystemThe working principle of the label, first of all, it is necessary to clarify that these information is usually configured in the "Global Function Settings" of the Security CMS background.Here, you can set the name of the website, upload the logo image, fill in the record number and copyright statement, and even define some custom global parameters.systemLabel to retrieve and display them.
systemThe basic usage of Label is{% system 变量名称 with name="字段名称" %}Here,变量名称Is optional, if set, you can assign the obtained data to a temporary variable for subsequent reuse; if omitted, the tag will directly output the obtained content.name="字段名称"It is crucial, it tells the system which specific global configuration item you want to call.
Let's take a look at how to do it throughsystemLabel to call and display these common global configuration information of the website:
FirstlyWebsite Name.It usually appears in the title bar, navigation bar, or other prominent positions, representing your brand.{% system with name="SiteName" %}To retrieve. For example, place it in the HTML's<title>Tags within, can effectively enhance the search engine optimization (SEO) effect.
Then isWebsite LogoAs the visual identity of the website, the display of the Logo is crucial. After uploading the Logo image on the backend, through{% system with name="SiteLogo" %}You can get the image address. In the template, you can embed it like this: <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />Here, we cleverly combine the Logo image with the website name as the alternative text (alt attribute), which improves accessibility and also helps with SEO.
Website filing numberIs the embodiment of compliance operation of domestic websites. The record number filled in the "Global Function Settings" can be accessed via{% system with name="SiteIcp" %}It is often placed at the bottom of the website and linked to the MIIT record query website, for example:<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a>.rel="nofollow"Here the attribute reminds the search engine not to track this link,target="_blank"Let the link open in a new window to maintain the user's experience on your website.
Copyright InformationGenerally displayed at the footer of a website, declaring the ownership of the website content. After filling in the relevant content in the 'Copyright Information' field under the 'Global Function Settings' in the background, you can use{% system with name="SiteCopyright" %}Get it. It is worth noting that if your copyright information contains HTML tags (such as©), in order to parse and display them correctly, you may need to use them in conjunction with|safeFilter, for example:<div>{% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}</div>.
In addition to the above core information,systemLabels can also help you access other important global settings, such as:
- Website Home Address (
BaseUrl) and mobile end address (MobileUrl)These are very useful when building internal links or handling mobile adaptation. - Template Static File Address (
TemplateUrl)When you need to refer to the CSS, JS, or other static resources under the current template directory,{% system with name="TemplateUrl" %}it can provide the correct path, for example:<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">. - The current template directory name (
TemplateName) And close station prompt content (SiteCloseTips): These can also be accessed throughsystemtags, making it convenient for templates to dynamically adjust according to the current state or the template used. - Site language (
Language)In multilingual websites, this can be used to set HTML'slangproperty, for example:<html lang="{% system with name='Language' %}">.
One of the strong points of AnQi CMS is that it allows you to add in theCustom Parameters.If you have special requirements, such as needing a universal help page link for the entire site, you can add a custom parameter named “HelpUrl” in the backend and fill in the link address.{% system helpLink with name="HelpUrl" %}{{helpLink}}Come and flexibly call this custom link.
For the multi-site supportable CMS deployment.systemthe tag also provides,siteIdParameters. If you need to display global information from another site in a template of a site, just specify the target site in the tag.siteIdfor example{% system with name="SiteName" siteId="2" %}English translation: such that cross-site information can be flexibly called.
In short,systemTags are a fundamental and powerful tool in the development of Anqi CMS templates.It seamlessly connects the background global configuration with the front-end display, allowing website operators to efficiently manage and update all kinds of general information of the website, whether it is brand image, legal statements, or functional links, all can be realized through unified control and display, thus greatly enhancing the maintainability and user experience of the website.
Common Questions (FAQ)
Question: Why do I get
{% system with name="SiteCopyright" %}After calling the copyright information, if the content contains HTML tags (such as<br/>In the page, it will be displayed directly instead of being parsed as a line break?答:This is because the security CMS template engine defaults to escaping HTML entities in the output content for security reasons. If your copyright information indeed needs to include HTML tags, and you confirm that this content is safe, you can use it when calling.|safeFilter to indicate that the template engine should not escape this content, for example:<div>{% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}</div>.问:I have added a custom parameter named "客服电话" in the "Global Function Settings" in the background, how can I call its value in the template?答:You can through
nameParameter to specify the name of your custom parameter. If your custom parameter name is "Customer Service Phone Number", then you can call it like this in the template:{% system customerPhone with name="客服电话" %}{{customerPhone}}Make sure thatnameThe value in the parameter is exactly the same as the custom parameter name you set in the background.问:My security CMS has set up multiple sites, can I display the site name of another site in a template of one site?Answer: Yes.
systemtag supportsiteIdParameters allow you to specify the target site ID for the information you want to retrieve. For example, if you want to display the website name of the site with ID 2 on the current site, you can use it in this way:{% system otherSiteName with name="SiteName" siteId="2" %}{{otherSiteName}}This will allow you to flexibly share and display global configuration information in a multi-site environment.