In the vast realm of website operations, providing customized content services for different user groups is a key factor in enhancing user experience, increasing user stickiness, and even achieving content monetization.As an experienced user and operations expert of AnqiCMS, I know that its flexible and powerful functions are enough to support us in achieving these refined operation goals.Today, let's delve deeply into a very useful tag in AnqiCMSarchiveFiltersAnd focus on how to skillfully use it, to provide exclusive content filtering options for specific groups like VIP users.
InsightarchiveFilters: Your intelligent filtering assistant
AnqiCMS'sarchiveFiltersA tag, like an intelligent content classification and retrieval assistant, it can automatically generate a series of filtering conditions for users to choose from based on the custom fields preset in your content model.Imagine if your website's content was diverse, users might need to search for interesting information based on multiple dimensions such as 'release year', 'content type', 'specific tags', and more.archiveFiltersIt is precisely to meet this need that it was born.
The core magic lies in the deep integration with the flexible content model of AnqiCMS. When you define custom fields of the type "Single selection", "Multiple selection", or "Drop-down selection" in the content model, the options of these fields will bearchiveFiltersAutomatically recognize and convert it into a front-end filter condition. For example, a food blog can filter recipes based on 'Cuisine' (Chinese, Western), 'Flavor' (sweet, spicy, salty), etc.;A software download site can filter software according to the "operating system" (Windows, Mac, Linux) or the "licensing method" (free, paid).
archiveFiltersThe label usage is very intuitive, you usually call it on the document list page:
{% archiveFilters filters with moduleId="YOUR_MODULE_ID" allText="全部" %}
{# 循环输出筛选条件的代码 #}
{% endarchiveFilters %}
Among themmoduleIdSpecifies which content model's documents to filter (for example,1may represent the article model,2which may represent the product model),allTextIt defines the display text for the "All" option.
Unlock exclusive filters for VIP users: operation strategy and implementation
The AnqiCMS built-in user group management and VIP system provides the ability to distinguish user identity. CombinedarchiveFiltersWe can further provide VIP users with a dedicated filtering channel, allowing them to access exclusive content faster and more conveniently.
The core idea is:Define a custom field in the content model to mark content access permissions, for exampleaccess_levelAnd set its options to 'public content' and 'VIP exclusive'.Then, in the front-end template, we judge the current user's VIP status to decide whether to display the 'VIP Exclusive' filter option.
Let's see how to implement it step by step:
- Define an access permission field in the content model:First, you need to log in to the AnqiCMS backend and navigate to "Content Management" -> "Content Model".Select the content model you want to provide with VIP filtering (for example, the "Article" model).When editing the model, click "Content Model Custom Field" to add a new field.
- Parameter name:Can be "Access Permission" or "Member Level".
- Call field:Suggest using English letters, for example
access_level. - Field type:Choose "Single Selection" or "Dropdown Selection".
- Default: