In AnQi CMS, what parameters does the `moduleDetail` tag support to specify the model to be retrieved?

Calendar 👁️ 92

As an experienced website operation expert, I am well aware that accurately calling and displaying the details of the content model in a flexible and efficient content management system like AnQiCMS is the key to building a functional and user-friendly website.The Anqi CMS, with its powerful custom content model capabilities, allows us to flexibly build data structures based on various business needs (whether articles, products, or event pages).Today, let's delve deeply into the process of template development using AnQiCMS,moduleDetailHow tags support us in specifying and obtaining details of the desired content model.

In-depth Analysis of AnQiCMSmoduleDetailTags: How to accurately obtain the content model you want.

In the AnQiCMS template system,moduleDetailTags play a role in obtaining detailed information about specific content models.It is not just a simple data pull, but also the foundation for us to achieve highly customized content display.Imagine that your website has three different types of content models, 'articles', 'products', and 'services', each with its unique fields and display logic.When you need to display metadata of a content model (such as the model name, description, or link) on a page, such as a sidebar or a specific module,moduleDetailTags come in handy.

Tell the system exactly which content model you want to obtain,moduleDetailTags mainly provide two key parameters:idandtokenIn addition, if you are operating in a multi-site environment, there is also asiteIdParameters can be used.

1. By model ID (id) to specify the model

The most direct and accurate way is to use the unique identifier of the content model —idSpecify. Each content model created in the AnQiCMS backend will have a system-generated numeric ID.If you know the ID of the content model you want to call, you can pass it directly as a parameter tomoduleDetail.

For example, if you want to get the model details of the model with ID 1 (usually the default article model), you can use it like this:

<div>文章模型名称:{% moduleDetail with name="Title" id="1" %}</div>

Here, id="1"Tell exactlymoduleDetailLabel to find the content model with ID 1, then go throughname="Title"Get the name of the model and display it. This method is suitable when you have a clear understanding of the model ID, or need to hardcode a specific model in the template.

2. By model URL alias (token) to specify the model

In addition to the numeric ID, AnQiCMS also allows you to set a SEO-friendly URL alias for the content model, namelytoken. This alias is usually the lowercase letter combination of the model, such as "article" or "product"。When you need to specify a model in a template in a more readable or URL-structured way,tokenParameters make it very convenient.

Assuming your product model URL alias is 'product', you can get the link like this:

<div>产品模型链接:{% moduleDetail with name="Link" token="product" %}</div>

UsetokenThe benefit is that even if the internal ID of the model changes, as long as the URL alias remains the same, your template code will still work properly, which brings convenience to the maintenance of the template.

3. Cross-site call model information (siteId)

One of the highlights of AnQiCMS is that it supports multi-site management, which means you can operate multiple independent websites within a single system.In some advanced application scenarios, you may need to call information about a content model created by another site in the current site template. At this point,siteIdThe parameters took effect.

If you have a sub-site with ID 2 and you want to get the model name with ID 3 in that site, you can do it like this:

<div>子站点模型名称:{% moduleDetail with name="Title" id="3" siteId="2" %}</div>

It should be noted that,siteIdGenerally, it is only necessary to specify explicitly in a multi-site environment. By default,moduleDetailThe tag automatically retrieves the content model information of the current site, so if you only manage one site or only call the model of the current site, you can omit this parameter.

4. Get the specific attributes of the model (name)

Once you specify which content model to retrieve, the next step is to determine which part of the model's information you want to display. This is done bynameParameter to achieve.moduleDetailThe tag supports retrieving various built-in properties of content models, including but not limited to:

  • Id: The numeric ID of the model.
  • Title: The display name of the model in the background (such as “Article”, “Product”).
  • Name: The English name of the model (usually similar to the token, but may be used for internal identification in some contexts).
  • Keywords: Keywords at the model level.
  • Description: Brief introduction at the model level.
  • Link: The home page link of the model.
  • TableName: The table name corresponding to the model in the database (often used for developers' reference).

You can optionally display these properties as needed. If not specifiednameThe parameter, or assignmoduleDetailAs an assignment of a variable, you can obtain the entire model object and then access its properties through dot notation.

For example, assign the entire model object to a variable and display its introduction:

{% moduleDetail articleModel with id="1" %}
<div>文章模型简介:{{ articleModel.Description }}</div>

In summary,moduleDetailThe tag is a powerful tool in AnQiCMS template development, which empowers developers to accurately obtain and display content model metadata. By flexibly usingid/tokenandsiteIdParameters, you can easily master the call logic of the content model, combiningnameThe parameter retrieves the required attributes to build highly dynamic and customizable website pages.Mastering the use of these parameters will greatly enhance your efficiency and flexibility in AnQiCMS content operation and template creation.


Frequently Asked Questions (FAQ)

  1. moduleDetailTags andarchiveDetailWhat are the differences between tags?

    • moduleDetailUsed to getThe content model itselfdetails, such as the name, description, or link of the 'Article Model'. It focuses on the metadata of content structure types.
    • archiveDetailis used to geta specific documentdetails, such as the title, content, and publication time of a specific “article”. It focuses on the specific content entities under the model. In simple terms,moduleDetailThe information obtained is of the type 'article' andarchiveDetailThe content of this specific article about the latest news of AnQiCMS.
  2. moduleDetailCan the tag get the list of all content models?

    • No.moduleDetailThe tag was designed initially to geta singleThe details of the content model. If you need to retrieve a list of all content models or iterate through them, you usually need to go through other specialized tags (such as possibly existingmoduleListAlthough the document does not directly display this label, AnQiCMS design usually provides a similar function) or process it in the controller layer.moduleDetailThe essence lies in "details" rather than "list".
  3. If I don't know the model'sidortokenhow should I look for it?

    • You can log in to the AnQiCMS backend management interface, under the "Content Management" section, to view and manage all created content models.Each model will clearly display its ID and URL alias (token).This is the most direct and reliable way to search.

Related articles

How to use the `moduleDetail` tag to get the content model ID of the current page?

As an experienced website operations expert, I know that understanding and flexible use of the underlying data structure in a content management system is the key to efficient operations and personalized display.AnQiCMS (AnQiCMS) leverages the efficiency and flexibility of the Go language and its content model to provide us with powerful technical support.Today, let's delve deeply into a seemingly simple yet extremely practical feature: how to use the `moduleDetail` tag to accurately obtain the content model ID of the current page, thereby bringing more possibilities to our content operation and template customization.

2025-11-07

In addition to placeholders, what creative uses can AnQiCMS's content generation feature be used for?

Certainly, as an experienced website operations expert, I am happy to discuss creative uses of AnQiCMS's content generation function, aside from placeholders?This topic, combined with the powerful functions of AnQiCMS, enables you to write a deep analysis article.

2025-11-07

Can AnQiCMS's content generation tool simulate user comments or messages?

As an expert who has been deeply involved in website operations for many years, I am well aware of the core role of the Content Management System (CMS) in building and maintaining an active website.AnQiCMS, with its high efficiency and flexibility, indeed provides many conveniences for content creators and operation teams.Today

2025-11-07

How can you implement A/B testing through AnQiCMS's content generation feature?

## Mastering AnQiCMS content generation: Strategies and practices for efficient A/B testing In today's rapidly changing online environment, the effectiveness of website content is directly related to user experience, conversion rates, and overall business goals.As an experienced website operations expert, I know that data-driven decisions are crucial for optimizing content strategy.And A/B testing is exactly the tool to verify content effectiveness and find the best solution.

2025-11-07

The `moduleDetail` tag's `name` parameter can be used to retrieve which specific fields of the model details?

As an experienced website operations expert, I am well aware that how to efficiently use the built-in tags in a rich-featured content management system like AnQiCMS to drive content display and management is the key to improving operational efficiency.Today, let's delve into the `moduleDetail` tag and its `name` parameter, which can help us accurately obtain the specific fields of the content model, providing strong support for the flexibility and maintainability of the website.

2025-11-07

I want to display the Chinese title of the current content model in the template, which field of the `moduleDetail` tag should be used??

As an experienced website operations expert, I know that the flexible use of templates in AnQiCMS (AnQiCMS) is the key to improving website operation efficiency and user experience.When faced with the need to dynamically display content model information, such as the Chinese title of the current content model, choosing the correct label field is particularly important.Today, let's delve deeply into how to accurately display the Chinese title of the current content model in the Anqi CMS template.

2025-11-07

How to retrieve information about a specific model through the content model's URL alias (`token`)?

## How to skillfully use AnQiCMS content model URL alias (`token`): The wisdom of accurately obtaining information As an experienced website operations expert, I am well aware of the importance of an efficient and customizable content management system for enterprise websites and content operation teams.AnQiCMS with its efficient architecture in Go language and versatile functions is gradually becoming a powerful assistant for many operators.In daily content management, we not only strive for the quality presentation of content, but also need efficient data access and management. Today

2025-11-07

If my AnQi CMS is a multi-site deployment, how to use the `moduleDetail` tag to retrieve the content model data of other sites?

AnQi CMS is an enterprise-level content management system designed specifically for small and medium-sized enterprises, self-media, and multi-site management, and its multi-site management capabilities are undoubtedly one of the core highlights.In daily operations, we often encounter such scenarios: we hope to display certain information of the child site on the main site, or to cross-reference content or data models between different sites.Today, let's delve into a specific and practical scenario - how to use the `moduleDetail` tag to obtain content model data from other sites in a multi-site deployed Aiqi CMS.###

2025-11-07