How to customize the display of image carousel (Banner) through template tags in AnQiCMS?

Calendar 👁️ 75

AnQiCMS as an efficient and customizable enterprise-level content management system has a significant advantage in the flexibility of content display.For the common picture slideshow (Banner) function on websites, AnQiCMS provides various ways to customize the display through template tags, allowing you to easily achieve a rich and diverse Banner display effect according to different page and business needs.

Understand AnQiCMS's Banner management mechanism

In AnQiCMS, the implementation of the image slideshow is not a single path, but provides a very flexible mechanism. You can choose the most suitable management method according to different scene requirements. There are mainly the following implementation paths:

  1. Global or Group Carousel (Home/General Banner): Suitable for the website's homepage, general pages, or specific theme module carousel.This type of carousel is usually managed in a dedicated area in the background (such as a related entry in "Website Navigation Settings" or a dedicated "Banner Management" module), and can be grouped and called by template tags.
  2. Category-Specific Carousel (Category Banner): Carousel set for specific product or article category. These Banners are directly bound to the category details and are displayed only on the category and its sub-pages.
  3. Single Page BannerCarousel images customized for independent single-page pages such as "About Us" and "Contact Us". They are stored in the content of the single page and only take effect on that page.

We will discuss step by step how to achieve these custom image carousel displays through AnQiCMS template tags.

core: usingbannerListTags can implement global or grouped carousels.

If you wish to display a slideshow of images on the homepage or some general area of the website,bannerListThe tag is your preference. This tag can directly retrieve the Banner list you have configured from the background.

Basic usage: Get default or home page Banner

The simplest way is to call directlybannerListTag, it will retrieve the default or home page configured Banner image:

{% bannerList banners %}
    {% for item in banners %}
    <a href="{{item.Link}}" target="_blank">
        <img src="{{item.Logo}}" alt="{{item.Alt}}" />
        <h5>{{item.Title}}</h5>
        <p>{{item.Description}}</p>
    </a>
    {% endfor %}
{% endbannerList %}

In this code block:

  • {% bannerList banners %}Defined a namedbannersThe variable that will contain all the default Banner data.
  • {% for item in banners %}Loop throughbannersEach Banner item in the array.
  • item.Link: The link address to which the carousel will jump after clicking.
  • item.Logo: Carousel image address.
  • item.Alt: The image'saltAttribute text, used as an alternative text when the image cannot be displayed, and also beneficial for SEO.
  • item.Title: It is usually the title or brief text of a Banner.
  • item.Description: Detailed description text of a Banner.

You can also add some dynamic effects based on the number of loops. For example, add one to the first BanneractiveClass, this is common in many frontend carousel components (such as Bootstrap Carousel):

{% bannerList banners %}
    {% for item in banners %}
    <a class="{% if forloop.Counter == 1 %}active{% endif %}" href="{{item.Link}}" target="_blank">
        <img src="{{item.Logo}}" alt="{{item.Alt}}" />
        <h5>{{item.Title}}</h5>
    </a>
    {% endfor %}
{% endbannerList %}

Hereforloop.CounterReturns the current iteration count (starting from 1) in each loop.

Custom grouping: Implement a Banner carousel for a specific area.

The strength of AnQiCMS lies in the fact that you can not only set global

Related articles

How to display the number of views and comments on articles in AnQiCMS templates?

In website operation, the number of page views and comments on articles is an important indicator of the popularity of content and user engagement.AnQiCMS provides flexible template tag functions, allowing you to easily display these key data on the website front end, thereby better attracting visitors and enhancing content value.

2025-11-07

How to automatically parse the URL string in the text of AnQiCMS to make it clickable?

In daily content operation, we often need to embed various external or internal links in text content such as articles, product descriptions, and even category summaries.However, manually converting each plain text URL string into a clickable HTML link is not only time-consuming and labor-intensive, but also prone to link errors due to negligence, affecting user experience and search engine optimization.

2025-11-07

How to display the category thumbnail and name in the article list?

## SecureCMS: Display category thumbnails and names elegantly in article lists In website operation, the article list page is an important entry point for users to browse content and discover information.A beautifully designed, informative list of articles can not only enhance user experience but also effectively guide users to delve deeper into reading.The traditional article list may only display titles, publication time, summaries, and other information, making it somewhat monotonous.

2025-11-07

How to convert a timestamp to a specified date format and display it in the AnQiCMS template?

In Anqi CMS template design, we often encounter the need to display timestamp data in a human-readable date format.Whether it is the publication time of the article, the update date of the content, or the record of user activities, this data is usually stored in the database in the form of timestamps.It is particularly important to master how to convert timestamps to the specified date format in templates so that website visitors can clearly and intuitively understand this information.

2025-11-07

How to safely output HTML code in AnQiCMS templates without escaping?

When building and managing website content, we often need to display rich text content with specific formats or interactive effects on the page, such as the main body of articles, product descriptions, and even embedded video players or maps.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that, when handling these requirements, defaults to taking an important security measure: escaping the HTML code output in the template.

2025-11-07

How to display user details and user grouping information in the AnQiCMS user group management?

In AnQiCMS, effectively managing users and user groups is a key factor in building personalized websites, implementing membership strategies, and even achieving content monetization.By flexibly using its built-in template tags, we can easily display users' detailed information and their user group information on the website front end, providing a more customized and interactive experience.The "User Group Management and VIP System" feature provided by AnQiCMS allows website operators to divide different user groups according to business needs and define exclusive permission levels for these groups.

2025-11-07

What is the purpose of the `addslashes` filter in AnQiCMS templates?

During the AnQiCMS template development and content operation process, we often encounter situations where we need to display dynamic content on the web page.This content may come from a database, be entered by a user, or generated by the system.Most of the time, the AnQiCMS template engine automatically escapes output variables for security reasons, converting `<` to `&lt;This effectively prevents common cross-site scripting (XSS) attacks by converting `,`"` to `&quot;` and so on.However, in certain specific scenarios, simple HTML

2025-11-07

The `addslashes` filter adds backslashes to which 'predefined characters'?

In website operation, we often deal with various types of content from different sources, especially when this content is input by users, it may contain some special characters.These characters, if not properly handled, may cause unexpected problems during page display or data transmission, and even destroy the website structure.AnQiCMS provides many practical filters to help us handle these situations, where the `addslashes` filter is a very useful tool, specifically designed to handle predefined characters in strings.

2025-11-07