As an experienced website operations expert, I often deal with various content management systems in my daily work and am well aware of the impact of every detail function on the efficiency of website operations.English CMS (EnglishCMS) stands out among many CMSs for its lightweight, efficient, and flexible features.bannerListTags not settypeWhen the parameter is set, which Banner group will it default to call?
Unveiling the AanQi CMSbannerListLabel: Not settypeWhen the parameter is set, which Banner group will it default to call?
In website operation, the Banner carousel is a key element to attract users' attention, convey core information, and guide user behavior. AnQiCMS provides powerfulbannerListTags allow operators and developers to flexibly control the display of Banners in different areas of the website. However, for developers who are new to AnQiCMS or use the tag without a thorough understanding, a common question is: if there is no explicit specificationtypeParameter, how will the system handle it?
The answer is:WhenbannerListThe label has not been settypeWhen the parameter is specified, AnQiCMS will default to calling the Banner group named 'default'.
This design concept reflects AnQiCMS's consideration of ease of use.On most website designs, the homepage or main content area usually has a generic Banner carousel, carrying the most core promotional content of the website.bannerListThe default behavior of the label.This means that even if you are using the tag for the first time, or you just need a standard main Banner area, you do not need to perform any additional parameter configuration, and the system can intelligently display the preset carousel content.This greatly simplifies the work of template development and the initial website construction.
UnderstandingbannerListBasic usage of the tag
bannerListThe label is mainly used to obtain Banner data from the background and display it in a list format on the frontend. It will store the obtained Banner data in a variable that you can name freely (for example,bannersThis variable is an array object, you need to iterate through it to display the detailed information of each Banner.
A basic call example without any parameters.typeThe parameter, it will default get all Banners under the “default” group:“
{% bannerList banners %}
{% for item in banners %}
<a href="{{ item.Link }}" target="_blank">
<img src="{{ item.Logo }}" alt="{{ item.Alt }}" />
<h5>{{ item.Title }}</h5>
</a>
{% endfor %}
{% endbannerList %}
In the above code:
{% bannerList banners %}: Declare to get the Banner list, and assign its data to the name ofbanners.{% for item in banners %}: Iterate overbannersTranslate each Banner data item in the array, and assign it.itema variable.{{ item.Link }}: Output the current Banner's link address.{{ item.Logo }}: Output the current Banner's image address.{{ item.Alt }}:Output the current Banner image's Alt text, which is very important for SEO and accessibility.{{ item.Title }}:Output the current Banner's title text, usually used to display at the top of the image or as a prompt message.
Use flexiblytypeParameter call a specific group
Of course, as an experienced operations expert, we know that the needs of the website are often diverse.You may want to display different themes of Banners in different areas of the website, such as "News Center BannerThis is where the Banner Grouping function of AnQiCMS comes into play.
You can create multiple Banner groups in the AnQiCMS backend and upload corresponding Banner images for each group. When you want to call a specific group's Banner, just inbannerListspecify in the tag.typeThe parameter and its corresponding group name can be found here.
For example, if you have created a Banner group named 'Slide' in the background, you can call it in the following way:
{# 调用名为“幻灯”的Banner分组 #}
{% bannerList banners with type="幻灯" %}
{% for item in banners %}
<a href="{{ item.Link }}" target="_blank">
<img src="{{ item.Logo }}" alt="{{ item.Alt }}" />
<h5>{{ item.Title }}</h5>
</a>
{% endfor %}
{% endbannerList %}
Through this way, you can easily manage and display all customized Banner content on the website, greatly enhancing the flexibility and operational efficiency of the website content.
Operation Tips
- Unified naming conventions:When creating a Banner group in the background, it is recommended to use meaningful and easily distinguishable names, and align them with the front
typeend parameters to avoid confusion. - Optimize image size:No matter which group's Banner, the image file size should be optimized to ensure the website loading speed and enhance the user experience.
- Perfect the Alt attribute:Add descriptive text to each Banner image
altThis not only helps with SEO, but also improves the accessibility of the website. - Regular updates:Maintain the timeliness and freshness of the Banner content, regularly update promotional, event, or new product information, which can better attract users.
In summary, AnQiCMS'sbannerListTags are not specifiedtypeWhen parameters are set, it will intelligently default to calling the "default" Banner group, providing the convenience of out-of-the-box use for the website. And by usingtype参数进行分组调用,您可以为网站的各个角落注入定制化的视觉活力,有效地支撑运营策略的落地,实现内容的精准营销和高效分发。
Common Questions (FAQ)
How to create a new Banner group in the AnQiCMS backend?Generally, you can find the 'Banner Management' or 'Slide Management' entry under the 'Content Management' or 'Page Resources' related menus in the AnQiCMS backend.Enter and you can add new Banner entries, and select or create a new group name when editing.The specific path may vary slightly depending on the AnQiCMS version or theme settings, it is recommended to consult the backend operation manual or search within the relevant modules.
If I create a new Banner group, but the front-end still displays the Banner of the "default" group, what could be the reason?This is usually due to the front-end template.
bannerListtags are not set correctlytypethe parameter, ortypeThe value of the parameter does not match the group name created in the background (including case sensitivity, full-width and half-width, etc.). Please check the front-end code to ensure that{% bannerList banners with type="您的分组名" %}The group name you entered is consistent with the settings on the backend.In addition to the home page Banner, what other positions can AnQiCMS set Banner images?The design of AnQiCMS is very flexible. In addition to using
bannerListthe global Banner called by tags, according to the document description, you can also indocument categories (Category)andSingle Page (Page)Find the "Banner image" settings option in the editing interface.This means you can set a dedicated Banner for specific category pages or independent pages, further enhancing the customization and visual appeal of the content.