The `{% diy %}` tag supports multiple calls to different custom content on the same page?

Calendar 👁️ 58

AnQiCMS'{% diy %}Label: A powerful tool for flexibly controlling page content

As an experienced website operations expert, I am well aware of the importance of a flexible and efficient content management system for a corporate website.AnQiCMS (AnQiCMS) provides us with many conveniences in the field of content operation with its excellent functional design.Today, let's delve deeply into a feature that is often inquired about but is extremely practical{% diy %}(Custom content) label, especially whether it supports multiple calls of different custom content on the same page

The answer is yes. Anqi CMS's{% diy %}The tag is designed to be very flexible, fully supporting multiple calls on the same page, and can easily display different customized content.

{% diy %}The versatility of the tag: the Swiss Army knife for content operation

In AnQi CMS,{% diy %}Tags are the core tools for highly customized and centralized management of website content.It allows operation personnel to pre-set independent, reusable text, links, and even complete HTML code snippets in the background.This content can be the record information of the website, contact number, unified advertising language, footer copyright statement, or even a personalized introduction text for a specific page.

Imagine, when you need to update the contact phone number of the entire site, you do not need to modify each template file. Just update the corresponding custom contact information in the background once, and all pages that call this content will be synchronized updated.This greatly improves the efficiency of content maintenance and reduces the risk of errors.

How to call different custom content on the same page?

{% diy %}The principle of the tag is very intuitive. Its core lies in the way thatnameParameters can be used to specify the "custom parameter name" you create in the background. Each uniquenamevalue corresponds to a specific piece of custom content.

Therefore, when you need to display multiple different custom contents on the same page, you just need to use an independent{% diy %}Label and specify differentnamevalues. Anqicms will accurately extract the corresponding content from the background database according to the values you provide and display it on the page.namefrom the background database and present it on the page.

For example, your website homepage may need to display three different custom contents such as 'Company Profile', 'Contact Email', and 'Latest Announcement Title'. In the Anqi CMS backend 'Global Settings' or 'Content Settings', you can create three custom parameters separately, for example namedCompanyName/SupportEmailandLatestNewsTitle. Then in your homepage template, you can call them like this:

<!-- 调用公司名称 -->
<p>欢迎访问:{% diy companyName with name="CompanyName" %}{{companyName}}</p>

<!-- 调用支持邮箱 -->
<p>技术支持:<a href="mailto:{% diy email with name="SupportEmail" %}{{email}}">{% diy email with name="SupportEmail" %}{{email}}</a></p>

<!-- 调用最新公告标题 -->
<h2>最新动态:{% diy newsTitle with name="LatestNewsTitle" %}{{newsTitle}}</h2>

In this example, even if these three tags appear consecutively on the same page, they will be becausenameThe difference in properties allows for the retrieval and display of three completely unrelated customized contents. This fully demonstrates{% diy %}The flexibility of tags in content composition and page construction.

If you need to display the same content multiple times at different positions on the pageThe same paragraphCustom content, for example, if you want the same company copyright information to be displayed at the top and bottom of the page, you can simply call the same one multiple times.nameof{% diy %}Label it. No matter how many times it is called, it will always display the content you set in the background.

<!-- 页面顶部版权信息 -->
<header>
    <span>{% diy copyright with name="SiteCopyright" %}{{copyright}}</span>
</header>

<!-- 页面底部版权信息 -->
<footer>
    <span>{% diy copyright with name="SiteCopyright" %}{{copyright}}</span>
</footer>

CombinesiteIdParameters, to achieve content sharing across multiple sites

It is worth mentioning,{% diy %}Tags also supportsiteIdParameter. If you are operating multiple Anqi CMS sites and want to call a custom content of another site on a certain site (for example, sharing a unified customer service phone number), then you can{% diy %}Labeling the target site specified in the tagsiteIdThis further expands the application scenario of custom content tags, bringing great convenience to multi-site management.

Conclusion

Of Security CMS{% diy %}Tags are a rare tool in website operations. They allow you to easily display various customized content flexibly on the same page, whether it's calling different information blocks or reusing the same content multiple times, you can do it with ease.This design philosophy is the embodiment of AnQi CMS's commitment to providing efficient and customizable solutions, making content management more intelligent and efficient.


Frequently Asked Questions (FAQ)

  1. Q: I created custom content in the background, but the label is not displayed on the page{% diy %}What could be the reason for no content display after the label?A: There are usually several reasons. First, make sure you are using in the template.nameThe parameter value is exactly the same as the custom content setting of the "parameter name" in the background, including case sensitivity.Next, check whether the custom content has been saved successfully in the background.If the content is blank,{% diy %}The label will also be displayed as blank. In some cases, you may need to update the system cache, and you can try clearing the cache after refreshing the page in the "Update Cache" feature in the background.

  2. Q:{% diy %}Can tags be used to store and display HTML code? For example, a complex advertisement code or structured text?A: Absolutely. Enter the complete HTML code in the background custom content, and then when calling the template, it is recommended to combine|safea filter. For example:{% diy adCode with name="TopBannerAd" %}{{adCode|safe}}.|safeThe filter informs the Anqi CMS that this is safe content, which does not require HTML escaping, so that the browser can correctly parse and render the HTML code you define.

  3. Q: If I want to dynamically decide which custom content to call (for example, based on user role or page type),{% diy %}Can the tag do that?A:{% diy %}label'snameThe parameter is a static string, it cannot directly accept template variables as its value. But you can combine{% if %}or{% set %}Label, indirectly implements dynamic selection. For example, you can set a variable in the template based on conditions, and then use this variable to decide which one to call in different{% diy %}the call to choose which onenameParameter. Or, a more common practice is to call different{% if %}blocks based on conditions.{% diy %}tags to display predefined different content.

Related articles

The value obtained by the `{% diy %}` tag, can it be further processed in the filter?

As an experienced website operation expert, I have accumulated rich experience in the practical application of AnQiCMS, and I particularly understand the importance of content flexibility to the vitality of a website.Today, let's delve into a question that many AnQiCMS users have been curious about: whether the custom value obtained from the `{% diy %}` tag can be further processed in template filters?In short, the answer is affirmative, and this ability greatly broadens the imagination space for AnQiCMS template customization and content operation.

2025-11-06

How to set and get custom website sidebar content using the `{% diy %}` tag?

As an experienced website operations expert, I know that the flexibility of the website content management system is crucial for operational efficiency.AnQiCMS (AnQiCMS) provides us with many powerful content management functions with its concise and efficient architecture.Today, let's delve deeply into one of the very practical and flexible features - how to set and get custom website sidebar content using the `{% diy %}` tag.

2025-11-06

Can the `{% diy %}` tag be used to call custom configurations of specific modules, such as only for the article module?

In the practice of template development for Anqi CMS, the `{% diy %}` tag is used frequently, providing website operators with great flexibility to customize and call various information configured in the background.However, many developers may feel confused about whether it can accurately call a custom configuration for a specific content model such as "only for article modules".Today, as an experienced website operations expert, I will deeply analyze this mechanism based on the AnQi CMS documentation and guide you on how to correctly use template tags in different scenarios.

2025-11-06

How to use the `{% diy %}` tag to get custom parameters and control formatting and styling on the front end?

As an experienced website operations expert, I am well aware that the flexibility of a Content Management System (CMS) is the key to improving operational efficiency and website performance.AnQiCMS (AnQiCMS) stands out in this aspect due to its excellent customizability, especially with the feature of obtaining custom parameters through the `{% diy %}` tag, which brings great convenience and imagination space for the layout and style control of front-end content.Today, let's delve into how to巧妙运用 this feature, making your website content both beautiful and functional.

2025-11-06

What is the main function of the 'Document Tag' feature in AnQiCMS?

As an experienced website operations expert, I know that every function of the Content Management System (CMS) can become a key to improving website operations efficiency and effectiveness.In AnQiCMS, such a content management system that focuses on enterprise-level applications and SEO optimization, the 'Document Tag' feature is not just a simple content classification, it is more like a multi-functional Swiss Army knife, providing deep empowerment for content organization, user experience, and search engine optimization.In AnQiCMS, the main function of the 'Document Tag' feature can be deeply understood from the following core dimensions

2025-11-06

How to add Tag tags for articles and products in the AnQiCMS background?

As an experienced website operations expert, I am well aware of the importance of tags (Tag) in content management and search engine optimization.AnQiCMS as an efficient and flexible content management system, its built-in tag function provides great convenience for operators.Today, let's delve into how to easily and efficiently add Tag tags to your articles and products in the AnQiCMS backend, and transform them into a powerful tool to enhance the value of your website.

2025-11-06

How should the 'document label' and 'document classification' be selected and matched in content organization?

In the daily operation of AnQiCMS (AnQiCMS), how to organize content efficiently and systematically is a problem that every operator needs to think deeply about.Among them, 'Document Classification' and 'Document Tag' are two core content organization tools, although their purposes are similar, their design concepts and application scenarios are quite different.Correctly understand and use them, not only can it significantly improve the user experience of the website, but it can also lay a solid foundation for SEO optimization.

2025-11-06

How to retrieve and display a specified number of document tag lists using `{% tagList %}` tags?

As an experienced website operations expert, I have accumulated rich experience in the practical application of content management systems, especially AnQiCMS (AnQiCMS).I deeply realize that efficient content operation is inseparable from in-depth exploration and flexible application of system functions.Today, we will focus on a powerful and commonly used tag in the AnQiCMS template - `{% tagList %}`, discussing how to cleverly use it to retrieve and display a specified number of document tag lists to optimize the website's content layout and user experience.### Label

2025-11-06