How to get and display the global configuration information (such as name, Logo) in AnQiCMS template?

As an experienced website operator proficient in AnQiCMS, I know that it is crucial for website maintenance, brand consistency, and user experience to efficiently and accurately obtain and display global configuration information in templates.AnQiCMS provides intuitive and powerful template tags, which can easily achieve this goal.

In AnQiCMS templates, obtaining and displaying the global configuration information of the website, such as the website name, Logo, filing number, etc., mainly depends on the built-in system.systemLabel.This tag is specifically designed to extract various core website information configured in the "Global Settings" of the background, ensuring that the website maintains a unified brand image and operational information on any page.

Core Tag: System

systemTags are the keys to access the global configuration data of AnQiCMS. Their basic usage method is{% system 变量名称 with name="字段名称" %}.变量名称is an optional parameter used to assign the obtained value to a temporary variable for multiple references or logical judgment in the template. If omitted变量名称The tag will directly output the value corresponding to the field.nameThe parameter is required, specifying the specific global configuration field you want to retrieve.

The AnQiCMS backend "Global Settings" module (located under "Backend Settings" -> "Global Settings") allows you to define various basic information about the website. This information can be directly accessed throughsystemThe label is called in the template.

Website Name (SiteName)

The website name is the identifier of the website, usually displayed in the browser title bar, header, and other locations. ThroughsystemLabel, easily obtain this information:

<title>{% system with name="SiteName" %} - 您的页面标题</title>
<h1>欢迎来到 {% system with name="SiteName" %}</h1>

You can also choose to assign it to a variable for more flexible use in the template:

{% system siteName with name="SiteName" %}
<header>
    <h1>{{ siteName }}</h1>
</header>

Website Logo (SiteLogo)

The website logo is the core element of brand visual identity. In AnQiCMS, the path of the uploaded logo image can be accessed throughsystemtags and applied to<img>tags.

<a href="/">
    <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
</a>

To enhance user experience and SEO effects, it is recommended to<img>use in tagsaltproperties, and set their values to the website name.

{% system siteLogo with name="SiteLogo" %}
{% system siteName with name="SiteName" %}
<a href="/">
    <img src="{{ siteLogo }}" alt="{{ siteName }}" />
</a>

Website record number (SiteIcp)

Websites operating in mainland China usually require recordal. AnQiCMS provides a configuration option for the recordal number in the background, throughsystemTags can display them at the bottom of the website or other required locations.

<footer>
    <p>备案号:<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a></p>
</footer>

Copyright information (SiteCopyright)

The copyright information of the website is usually displayed in the footer, used to declare the ownership of the website content.

<footer>
    <p>{% system with name="SiteCopyright" %} &copy; {% now "2006" %} All Rights Reserved.</p>
</footer>

Here we also integrate with{% now "2006" %}tags to dynamically obtain the current year, keeping the copyright information up to date.

Home page address (BaseUrl)

It is very useful to get the root URL of the website when building absolute links or performing page jumps.

<a href="{% system with name="BaseUrl" %}">返回首页</a>

Template Static File Address (TemplateUrl)

For convenience in referencing static resources (such as CSS, JavaScript, images, etc.) under the template directory, AnQiCMS providesTemplateUrlThe field points to the root path of static resources for the current active template.

<link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
<script src="{% system with name="TemplateUrl" %}/js/main.js"></script>

Custom parameters

In addition to the built-in global configuration items, AnQiCMS also supports adding custom parameters in the "Global Settings" section of the backend.These custom parameters can be used to store any information you wish to call globally across the website, such as customer service phone numbers, company fax numbers, custom social media links, and more.

Assume you have added a custom parameter named "CustomerServicePhone" with the value "400-123-4567" in the background. You can call it in the template like this:

<div>客服电话:{% system with name="CustomerServicePhone" %}</div>

This will greatly improve the flexibility and maintainability of the template, avoid hardcoding, and allow operations personnel to directly update information through the backend interface.

Application scenarios and **practice

These global configuration information is usually placed in the common area of the website, such as header, footer, or sidebar, etc. public template fragments. Through inbase.htmlorpartial/header.html/partial/footer.htmlIntegrating these tags in the files can ensure that all relevant information on the entire website is automatically synchronized after updating the background settings, without the need to manually modify each page.

For example, a typicalheader.htmlA file may contain the following structure:

<!DOCTYPE html>
<html lang="{% system with name='Language' %}">
<head>
    <meta charset="UTF-8">
    <title>{% tdk with name="Title" siteName=true %}</title>
    <meta name="keywords" content="{% tdk with name="Keywords" %}">
    <meta name="description" content="{% tdk with name="Description" %}">
    <link rel="stylesheet" href="{% system with name="TemplateUrl" %}/css/style.css">
    <link rel="icon" href="{% system with name="SiteLogo" %}" type="image/x-icon">
</head>
<body>
    <header>
        <div class="logo-area">
            <a href="{% system with name="BaseUrl" %}">
                <img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
            </a>
        </div>
        <nav>
            {# 导航栏标签 {% navList ... %} 通常会放在这里 #}
        </nav>
    </header>

This modular reference method, combined with the powerful global configuration management function of AnQiCMS, makes website content creation and operation more convenient and efficient.

Frequently Asked Questions

What should I do if I update the website name or Logo in the AnQiCMS backend, but the front-end page does not take effect immediately?

This is usually caused by system cache.AnQiCMS to improve the website access speed, will cache some data.After changing the configuration in the background, you need to go to the 'Update Cache' feature in the background and click to clear the system cache.After the cleanup is completed, the front-end page will display the latest configuration information.If it still does not work, try clearing your browser cache or access in incognito mode.

How can I reference the global configuration information of a specific site in the AnQiCMS deployment across multiple sites?

AnQiCMSsystemTag supportsiteIdParameters. If you have deployed multiple sites and want to display global information from other sites (such as the main site's logo) in the template of the current site, you can explicitly specifysiteIdFor example,{% system with name="SiteLogo" siteId="1" %}Will retrieve the Logo of the site with ID 1. Please note,siteIdis the unique ID assigned to each site in the multi-site management of AnQiCMS backend.

Can I get throughsystemLabel to get the current status of the website (such as whether it is closed) or the current language?

Yes,systemThe label can get this information. You can access it through{% system with name="SiteCloseTips" %}to get the closure notice information, and through{% system with name="Language" %}Get the language code of the current site. This information is very useful when rendering based on the site status or language, such as displaying a maintenance page, or setting according to the language code.<html>the tag'slangproperties.