How to use AnQiCMS built-in tags to get and display system configuration information (such as website name, Logo)?

In website operation and management, maintaining consistency of information and the convenience of updates is crucial.AnQiCMS as an efficient content management system, fully considers this point, providing powerful built-in tag features, allowing the global configuration information of the website (such as website name, Logo, filing number, etc.) to be easily obtained and displayed in the front-end template.This means you do not need to hardcode, just make a change in one place in the background, and all pages that reference this information will automatically update, greatly enhancing the maintainability and operational efficiency of the website.

Understand the system configuration of AnQiCMS

AnQiCMS focuses the core configuration information of the website in the 'Background Settings' -> 'Global Function Settings' module of the background. Here, you can manage and modify:

  • Website NameUsed for page titles, brand identifiers, etc.
  • Website LogoUsed for uploading the visual logo image of the website.
  • Website filing numberUsed for information that complies with legal filing requirements.
  • Copyright Information[en]Copyright notice typically displayed at the footer of a website.
  • [en]Home page address of the website.[en]The root domain or home page link of the website.
  • [en]Mobile end addressFor a specific address for mobile device access (if enabled).
  • Template static file addressFor convenient reference to CSS, JS, and other static resources.
  • Site languageCurrent website language settings.
  • and throughCustom ParametersFunctionality, you can add any additional configuration items according to the unique needs of your website, such as customer service phone number, company address, specific social media links, etc.

The centralized management of these configurations makes it very intuitive and efficient to control the global information of the website.

Core usage of system tags ({% system %})

In the AnQiCMS template files, we mainly use{% system %}Use this tag to obtain these system information configured in the background. This tag is designed to be very flexible and can be used in various ways to meet your specific needs.

Basic syntax:

{% system with name="字段名称" %}

This method will directly output the value of the specified field. For example, if you want to display the website name directly on the page, you can write it like this.

Assigned to a variable for use:

{% system 变量名称 with name="字段名称" %}{{ 变量名称 }}

If you wish to reuse a configuration information in multiple places in the template, or need to further process the obtained values (such as concatenating with other text), assigning it to a variable would be a better choice. This also improves the readability of the template code.

Environment with multiple sitessiteIdParameters:

If you have enabled the multi-site feature in the AnQiCMS backend and want to get the configuration information of other sites in the current template, you can addsiteIdTo implement:

{% system with name="SiteName" siteId="2" %}

Here are thesiteId="2"Refers to the site configuration information with ID 2.

Common system configuration items and their calls in the template

Let's take a look at some common system configuration items and how they are obtained and displayed in templates.{% system %}via tags.

1. Website Name (SiteName)

This is the basic identifier of the website, usually used in browser titles, page top navigation, etc.

  • Example call:
    
    <title>{% system with name="SiteName" %} - 您的副标题</title>
    
    Or assign to a variable:
    
    {% system siteName with name="SiteName" %}
    <h1>欢迎访问 {{ siteName }}</h1>
    

2. Website Logo (SiteLogo)

The website logo is an important part of the brand image. After uploading to the backend, you can easily refer to it in the template.

  • Example call:
    
    {% system siteName with name="SiteName" %}
    <img src="{% system with name="SiteLogo" %}" alt="{{ siteName }}" class="website-logo" />
    
    Here we assign the website name tositeNameVariable, as the Logo image.altAttribute value, helpful for SEO and accessibility.

3. Website filing number (SiteIcp)

Domestic websites need to display the filing number, AnQiCMS makes this operation simple.

  • Example call:
    
    <p class="icp-info">
        <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">
            {% system with name="SiteIcp" %}
        </a>
    </p>
    

4. Copyright Information (SiteCopyright)

The website footer often contains copyright statements, and tags can be used to flexibly manage this content.

  • Example call:“`twig