The performance of AnQiCMS (AnQiCMS) in multi-site management has always been our focus. Especially when we face things likewordcountThis content processing filter will naturally consider its application ability in cross-site scenarios.Deeply understand the design philosophy and template mechanism of Anqi CMS, and we can better understand its logic in this aspect.
Firstly, let's clarify things.wordcountThe function of the filter. According to the document,wordcountIt is a very practical text processing tool, which can calculate the number of words in a string.It calculates the number of words based on spaces and returns an integer in the end.For example, when we need to quickly count how many words a press release, a product description, or a user review has, this filter comes in handy.
The reason why Anqi CMS can efficiently manage multiple sites is due to its unique system architecture. It allows users toA single security CMS installation instanceCreate and manage multiple independent websites.This means that, although each site has its own content, configuration, and data, they all share a core codebase and a unified template engine.The advantage of this design pattern lies in the fact that the core functions and underlying logic are shared and consistent.
It is based on this shared architecture,wordcountFilter such basic text processing logic is also universally applicable in the entire security CMS system.It does not exist attached to a specific site but is part of the built-in feature of the template engine and can be applied to any string data accessible by the template.
Then, when we need to applywordcountFilter to the data fromother sitesWhat should you do when encountering this situation? This is where a very critical parameter in the Safe CMS comes into play:siteId. When we consult the template tag document of Anqi CMS, we will find that many core data acquisition tags, such asarchiveList(Document List),categoryList(category list),pageDetail(single page detail), evensystem(System Settings) andcontact(Contact information)tags, all support onesiteIdParameter.
ThissiteIdThe introduction of parameters is the key to achieving cross-site data access. It allows us to explicitly specify in the template of the current site,Which sitePull data. Once the data is successfully pulled and assigned to a variable in a template (for example, the content of a document is assigned to one of the variables){{ otherSiteArchive.Content }})wordcountThe filter can act on this variable as if it were local content.
In other words,wordcountThe filter itself does not have the ability to "cross-site query", it is just a pure string processing tool. But the Anqi CMS providedsiteIdThe parameter mechanism allows us to easily introduce string data from other sites into the context of the current template. Once the data is introduced,wordcountIt can be counted, thus realizing the statistical logic inthe shared applications on all sites under the entire security CMS instance management.
For example, suppose your security CMS manages two sites: the main site (siteId=1) and a sub-site (siteId=2)。You may want to display the word count of a specific article from a sub-site on a page of the main site. At this point, you will first usearchiveDetailTags, throughsiteId="2"and the specific article ID to get the details of the sub-site's articles, then assign the article content to a variable, and finally apply the filter to this variable.Contentfield) to a variable, and then assign it to a variable, and finally apply the filter to this variable.wordcountthe filter to this variable.
Therefore, we can conclude that in AnQiCMS multi-site management,wordcountthe filter and its statistical logic can be fully applied across sites. It is provided through AnQiCMS,siteIdParameters establish a connection with data from other sites and provide general statistical services after the data is successfully retrieved in the current template environment.This design ensures both the efficiency of the system and provides great flexibility, allowing content operators to more flexibly integrate and display data across site content.
Common Questions (FAQ)
1.wordcountCan the filter directly count the content from another site's database without first pulling it?No.wordcountThe filter is applied to the string variables that have been loaded in the template.It does not interact directly with the database to execute cross-site statistical queries.siteIdParameter data retrieval label (such asarchiveDetail/archiveListautowordcountFilter.
autositeIdautowordcountWill it affect the website performance?Within a reasonable range, there will be no significant negative impact. The multi-site architecture design of Anqi CMS inherently supports this data call. Each time throughsiteIdThe operation of obtaining data will always involve querying the database.If you make a large number of cross-site data calls on a single page, or call a large amount of data, this may increase the server load, thus slightly affecting the page loading speed.Suggest optimizing according to actual needs, such as caching frequently used data, or reducing unnecessary cross-site calls.
3. BesideswordcountWhat are some filters that can be applied cross-site to the data?In theory, all security CMS template engines built-in, acting on strings, numbers, arrays, and other basic data types, can be applied to data obtained from other sites in a similar manner. As long as you cansiteIdThe parameter successfully retrieves and assigns the target data to the template variable, thenlength/truncatechars/replace/dateThe vast majority of data processing filters can be operated on. The key point is 'whether the data has been loaded into the current template context'.