As an experienced website operations expert, I have a deep understanding of AnQiCMS (AnQiCMS) 's functional and content operation strategy. Today, we will discuss a topic that many users may be concerned about: archiveFiltersDoes the tag support control over the sorting method for custom parameters?
In-depth analysisarchiveFiltersDesign intent and functional boundaries
In the template system of Anqi CMS,archiveFiltersThe tag is designed as a powerful tool specifically for building dynamic filtering conditions.The core function is to automatically generate a series of filter options that users can choose from based on the custom parameters you define for the content model in the background (for example, product colors, sizes, article authors, series, etc.).These options are usually presented as links, and when the user clicks on them, the corresponding query parameters are added to the current page URL, thus achieving dynamic filtering of content.
For example, on a real estate website, you may define custom parameters such as 'floor plan', 'price range', 'decoration condition', etc. ByarchiveFiltersLabel, the system can automatically render filter conditions such as "One bedroom and one living room?huxing=两室两厅The parameter, the website will display content that meets the condition.
However, if you read carefullyarchiveFiltersThe official documentation of the tag will reveal that it does not provide any parameters directly used for controlling sorting, such asorderorsort. This is not a lack of functionality, but rather originates from its clear design positioning:archiveFiltersLies in the responsibility ofGenerate filtering conditionsTo help users narrow the scope of content, rather than on the final presentation of content,Arrangement orderIt focuses on 'How users can find the content they want based on certain conditions', rather than 'What order the found content should be displayed in.'
The attribution of sorting function:archiveListThe responsibility of tags
So, when we want to sort this filtered content, what should we do? The answer lies in another core tag of Anqi CMS:archiveList.
archiveListThe tag is a universal tag used in AnQi CMS to retrieve and display document lists. It can retrieve content based on various conditions (such as category ID, model ID, recommendation attributes, etc.). Among them,archiveListLabels clearly providedorderParameters allow you to specify the display sorting rules for the document. You can sort by built-in fields, such as sorting by the most recent published date (id descOr sort by the most viewedviews descEven can be sorted according to the custom sorting field of the backgroundsort descto arrange
From the design philosophy of Anqi CMS,archiveFilterswitharchiveListPlaying different roles, they form a clever collaborative relationship.archiveFiltersResponsible for constructing URLs with filtering parameters, andarchiveListthen responsible for parsing these URL parameters (when itstypeis set topageAt its ownorderThe parameters sort the retrieved data. This means thatarchiveFiltersHelped the user generate a “filter”, andarchiveListThen according to the result of the 'filter', the content will be presented according to the preset 'sort rule'.
Therefore, when you need to implement the filtering and sorting function on the page, the usual practice is toarchiveFilterstags for rendering the filtering UI, and toarchiveListLabel placement on the same page to display the content list. When the user passes througharchiveFiltersfiltering through the generated link.archiveListIt will automatically receive and process the filtering parameters in the URL, then sort and display the filtered results according to its internal settings.orderIn short,
Summary
In summary,archiveFiltersTags in AnQi CMS focus on generating dynamic content filtering options, and they do not have the ability to control content sorting. The sorting function is controlled byarchiveListThe tag can take on, you can set it througharchiveListoforderParameters to implement various sorting needs for content.Understanding the division of responsibilities and collaboration mechanism between these two will help you build and manage the content display logic of the Anqin CMS website more efficiently and flexibly.
Frequently Asked Questions (FAQ)
How to create and manage custom parameters in Anqi CMS?You can find the 'Content Model' feature under the 'Content Management' module in the AnQi CMS backend.Click to enter and you can choose to edit existing models (such as 'Article Model', 'Product Model') or create a new custom model.In the model editing interface, you can add various types of 'custom fields', and set parameters name, calling field, field type, whether it is required, and default value.
archiveFiltersAs the basis for filtering.archiveFiltersWill the generated filter link automatically update the content list?archiveFiltersThe tag itself is responsible for generating URLs with filtering parameters. To make the page content dynamic after clicking on these links, you need to use the tag in conjunction with the page.archiveListthe tag and use it.typethe parameter topageThus,archiveListCan read query parameters from the URL and automatically filter and display the corresponding content.The page usually reloads, or it can be refreshed without a page reload by working with JavaScript on the front end.Can I sort the content according to the value of the custom parameters?The current AnQi CMS
archiveListlabel'sorderParameters mainly support based on built-in fields (such asid/views/sortSort by performing. If your requirement is to sort based on a custom parameter value or a specific rule, this usually requires combining URL parameter passing with sorting instructions, andarchiveListParse these parameters in the tag, or you may need to customize template logic even perform secondary development of the AnQi CMS to achieve more complex sorting functions. The official documentation does not specify directlyarchiveListCan pass throughorderParameters directly sort the custom fields.