Anqi CMS template label manual
-
System Settings Tags
Description: Used to obtain system configuration information: {% system variable name with name="field name" %}. The variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The field names available for the name parameter are: website name SiteName website Logo SiteLogo SiteLogo website -
Contact Tags
Description: Use method for obtaining contact information for background configuration: {% contact variable name with name="field name" %}. The variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The field names available for the name parameter are: Contact UserName Contact Number Cellpho -
TDK Tags
Description: Use method for obtaining the title, keywords, and description information of the page: {% tdk variable name with name="field name" %}. The variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The field names available for the name parameter are: page title Tit -
Navigation List Tag
Description: Used to get the page navigation list: {% navList variable name %} If you define a variable as navs {% navList navs %}...{% endnavList %}, it can also be defined as other variable names. After definition, it needs to be consistent with the variable name used in the for loop below. The navList tag has no parameters, and you need to use it -
Classification list tags
Description: Used to obtain articles and product classification lists: {% categoryList variable name with type="1|2" parentId="0" %} If you define a variable as categories {% categoryList categories with type="1" parentId="0" %}. -
Category Details Tags
Description: Used to obtain article classification and product classification details usage method: {% categoryDetail variable name with name="field name" id="1" %} The variable name is not necessary. After setting the variable name, you can call it through the variable name in the future, without setting the variable name, and the result will be output directly. The supported parameters of categoryDetail are: id, id is not -
Document list tags
Description: Used to obtain a regular document list, related document list, and document paging list usage method: {% archiveList Variable name with categoryId="1" order="id desc|views desc" type="page|list" q="Search keyword" %} If you define a variable as archives {% a -
Document Details Tags
Description: Used to obtain document details data usage method: {% archiveDetail variable name with name="field name" id="1" %} Variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The supported parameters of archiveDetail are: Document ID idid is not required. -
Document Tag List Tag
Note: After we type various tags into the document, we can use the document tag list tag to call these tags. How to use: {% tagList variable name with limit="10" %} If you define the variable as tags {% tagList tags with limit="10" %}...{% endtagList %}tag -
Tag Document List Tag
Description: Use method for obtaining the document list of specified tags: {% tagDataList Variable name with tagId="1" %} If you define the variable as archives {% tagDataList archives with tagId="1" %}...{% endtagDataList %}tagDataLi -
Single page list tag
Description: Used to get a single page list: {% pageList variable name %} If you define a variable as pages {% pageList pages %}...{% endpageList %} pageList does not support parameters, so this tag will get all pages. If you need to exclude certain pages, you can eliminate unwanted pages in the subsequent for loop -
Single page details tag
Description: Used to obtain single-page detailed data usage method: {% pageDetail variable name with name="field name" id="1" %} Variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The supported parameters of pageDetail are: id. id is not required. The current order will be obtained by default -
Comment tag list
Description: How to use the comment list and comment paging list used to obtain the document: {% commentList variable name with archiveId="1" type="page|list" %} If you define the variable as comments {% commentList comments with archiveId="1" type= -
Message form tags
Description: How to use the message form used to obtain background settings: {% guestbook Variable name %} If you define the variable as fields {% guestbook fields %}...{% endguestbook %} This tag does not support parameters. fields is an array object, so you need to use a for loop to output item as a for loop -
Breadcrumb navigation tags
Description: Used to get the breadcrumb navigation list: {% breadcrumb variable name with index="Home" %} If you define the variable as crumbs {% breadcrumb crumbs with index="Home" %}...{% endbreadcru -
Previous document tag
Description: Used to obtain data from the previous document: {% prevArchive Variable name %} If you define the variable as prev {% prevArchive prev %}...{% endprevArchive %}prevArchive No parameters are supported. The fields supported by prevArchive are: Document ID Id Document title T -
Next document tags
Description: Used to obtain the data of the next document: {% nextArchive Variable name %} If you define the variable as next {% nextArchive next %}...{% endnextArchive %}nextArchive No parameters are supported. NextArchive The supported fields are: Document ID Id Document title T -
Tag details tag
Description: How to use the Tag Detail data used to obtain the document: {% tagDetail variable name with name="field name" id="1" %} variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The supported parameters of tagDetail are: TagID id. id is not required, default -
Statistical Code Tags
360/Toutiao and other JS code call tags for JS automatically submitted: {{- pluginJsCode|safe }} -
Related Document Tags
Description: Get relevant documents for the current document. The logic of the relevant documents is: obtain adjacent documents of the same category based on the document id of the current document. Therefore, this tag can only be used on the document details page. Usage method: {% archiveList Variable name with type="related" limit="10" %} If you define a variable as archives {% archiveL -
Other auxiliary tags
Some commonly used built-in tags. Nested references of templates. Include is often used when creating templates, we will extract some common parts, such as header, footer, aside, etc., and store them independently. There is no need to repeat them on each page, we just need to introduce them on each page. At this time, we can use include tag. {% include "par -
Pagination Tags
Description: How to use paging information used to obtain article list and product list: {% pagination variable name with show="5" %} If the variable is defined as pages {% pagination pages with show="5" %}...{% endpagination %}pagination Support A -
Document parameter tags
Description: Use method for obtaining the background settings of the specified document: {% archiveParams Variable name with id="1" sorted=true %} If you define the variable as params {% archiveParams params with id="1" sorted=true %}...{% endarc -
Document parameter filter tags
Document parameter filtering can only be used on the document homepage or document classification template, combined with the document paging list. Note: Used to perform filtering conditions for list combination screening based on various parameters of the document. For example, when building a real estate website, it can be used for residential, shop, commercial and residential purposes according to the type of house. At the same time, it can be additionally selected for single rooms, one bedroom, one living room, two bedrooms, two living rooms, three bedrooms and two living rooms, etc. according to the size of the house. In this case, the document parameter screening function can be used. make -
Friendly link tags
Description: Used to obtain the list of friendly links: {% linkList Variable name %} If the variable is defined as friendLinks {% linkList friendLinks %}...{% endlinkList %}linkList Do not support parameters, all friendly links will be obtained. friendLinks is an array object -
More filters
When outputting variables, filters are also supported to perform primary filtering of data. The format is: {{obj|filter__name:param}} For example, when a variable has a value, it outputs the current value. When there is no value, it outputs the default value: Use default to set the default value: {{ userName|default:"The hero anonymous"}} default as long as it is empty -
General tags - Define variable assignment tags
The template parser of the iris.Django template engine provides methods with which variables can be declared in templates and used. With we can temporarily declare single or multiple variables for subsequent use. In most cases, we will use it with the include tag. For example: {% with title="This is the title declared for the header" keywords="This is the sound -
Format timestamp tags
In the template, it supports direct formatting of timestamps into specified format output. Tag keyword: stampToDate. How to use: {{stampToDate(timestamp, "format")}}. The time stamp is 10 bits, such as 1609470335, the format is a format supported by Golang. Example: {% set publishStamp = 160947033 -
General tags - for loop traversal tags
for is used to iterate over each item in the array, making the item available in the context variable. For example, to display a list of articles provided in articleList: {% for item in articles %} <li class="item"> <a href="/article/{{item.Id}}" class="li -
General Tags - Remove logical tags to occupy rows
This requirement is often used, for example, in if-elseif or for loop, it will output empty lines of the rows in the if-else tag part. If you want to clean up this empty line, you can use - in front or behind the label to achieve filtering, such as: {%- if false %} 1st choice {%- elif false %} 2nd choice -
General tags - Arithmetic tags
integers and complex expressions using mathematical arithmetic in templates integers and complex expressions {{ 10-100 }} {{ -(10-100) }} {{ -1 * (-(-(-(10-100)) }} {{ -1 * (-(-(-(10-100)) }} {{ -1 * (-(-(-(10-100))) }} {{ -1 * (-(-(-(10-100))) -
General tag-if logical judgment tag
The tag determines the value of the expression. If the value of the expression is true, the body content will be executed. How to use: {% if condition %} ... {% endif %}, {% if condition %} ... {% elif Other conditions %} ... {% endif %}, {% if condition %} ... {% elif Other conditions %} ... {% elif Other conditions %} -
Leave a message verification code using tags
Leave a message verification code using tags -
Determine whether text and array contain specified keywords
How to determine whether a line of text string contains a certain keyword in Anqi CMS template? The contains filter can determine whether a keyword is contained in a line of strings, arrays, key-value pairs, and structures. The result will return a boolean value (bool). How to use contains How to use filter: {{obj|contain: Keyword -
Delete all leading and trailing spaces, specific characters in a string
How to delete all spaces or specific characters in the beginning and end of a string in Anqi CMS template? The trim, trimLeft, and trimRight filters can delete the beginning and end spaces of strings and specific characters respectively. The trim filter can delete the string's beginning and end spaces or specific characters; the trimLeft filter can delete the string's leading spaces or specific characters; the trimRight filter can delete the string -
Calculate the number of times a keyword appears in a line of strings and in an array
How to calculate the number of times a keyword appears in a line of string or array in Anqi CMS template? The count filter can calculate the number of times a keyword appears in a line string or array (array/slice). Usage method count How to use filter: {{obj|count: keyword}} For example, calculation Welcome to use calculation in AnQiCMS (AnQiCMS) CMS appears -
Filter: Split a line of text into an array by space
How to split a line of text into an array by space in Anqi CMS template? The fields filter can split a line of text into an array in a template by spaces. The defined array is a []string{}, which can be traversed in the subsequent output. Usage methods fields filter usage: {% set values = "Text content"|fields %} {% set v -
Get the location where a keyword appears in a line string or array
How to get the location where a keyword appears in a line of strings or arrays in Anqi CMS template? The index filter can calculate where a keyword appears in a line string or array (array/slice). If the string contains multiple keywords to be found, the index returns the first occurrence position. If not found, return -1. Note: If there is Chinese in the string, then the position is calculated -
Define an array in a template
How to define an array in the template in the Anqi CMS template? A list filter can define an array in a template. The defined array is a []string{}, which can be traversed in the subsequent output. Usage method list filter usage: {% set values = '["keyword 1","keyword 2","keyword 3"]'|list %} Use single quotes or double quotation marks for conversion -
Replace a specific keyword in a string to another keyword
How to replace a word in a string with another word in Anqi CMS template? The replace filter can replace the old word old in the string with the new word new, and return the replaced new string. If old is empty, it will match at the beginning of the string and after each UTF-8 sequence. If new is empty, remove old. Usage method replace filter usage: # -
Specify repeated multiple output strings
How to output a string repeatedly in the Anqi CMS template according to the specified number of times? The repeat filter can repeat a string by a specified number of times. How to use repeat Filter: {{obj|repeat: times}} For example, repeat the Anqi CMS 5 times, you can write this: {{"Anqi CMS"|repeat:5}} # Show results Anqi CMS Anqi CMS -
Generate random text
The lorem tag can generate random text content of a specified length. Usually used for typesetting needs. Usage method: {% lorem Quantity Method random %} The quantity can be calculated by the number of words or by the number of words, and it needs to be decided according to the method. The method is one of the following: 'w', 'p' or 'b'. random is whether it is random. If you fill in random, you will follow it if you fill in random. -
Add up of numbers or strings
Filter: Add up numeric or string -
Add a backslash before predefined characters
How to add backslashes to predefined characters in strings in Anqi CMS template? The addslashes filter can prefix the predefined characters specified. These characters are single quotes ('), double quotes ("), and backslashes (\). Usage Methods Addslashes Filters are used: {{ obj|addslashes }} For example, the predefined words in "CMS" are used in "CMS" -
Convert English string letters to uppercase or lowercase
How to convert English string letters to uppercase or lowercase in Anqi CMS template? The capfirst filter converts the first letter of the English string to capitalization. Only English letters will be converted. The lower filter converts all letters in an English string to lowercase. The upper filter can convert all letters in an English string to uppercase. title filter can transfer all words in an English string -
Center the string, left, and right in the specified length format
How to center the string, left, and right in the Anqi CMS template in the specified length format? The center filter can center the string in the specified length format. If the string length is greater than the specified length, it will be displayed according to the actual length of the string. If the string length is less than the specified length, the same number of spaces will be added to both sides of the string to achieve centering. If the number of spaces that need to be supplemented is singular, the spaces to allocate the right will be compared -
Removes specified characters from any position in the string
How to remove the specified characters in any position of the string in Anqi CMS template? The cut filter can remove specified characters from any position in the string. If you remove special characters, spaces, etc., you can use the cut filter usage method. Cut filter usage method: {{ obj|cut:"keyword" }} For example, if you remove s in test, you can write this way: {{ "test"|cu -
Display time values in the specified format
How to display time values in the Anqi CMS template in the specified format? The date filter can display time values in the specified format. But it should be noted that the input of date must be a time.Time value, otherwise it will not be processed and an error will be reported. The output format is set according to Golang's time format. You can also use time, which is the same as date and the result. It's a difference to date -
Default value settings for numbers or strings and objects
How to set the default value for numbers or strings in Anqi CMS template if there are no values in numbers or strings? The default filter can set default values for numbers or strings if there is no value in numbers or strings. The default_if_none filter can determine whether the object of the pointer type is empty. If it is empty, set the default value. Usage method default filter usage method: { -
Determine whether a number can be used as a divisor
How to determine whether a number or its calculation result can be used as a divisor in the Anqi CMS template? The divisibleby filter can determine whether a number or its calculation result can be used as a divisor. The filter will return a boolean value (bool), True means yes, and False means no. Usage method divisibleby How to use filter: {{ number| -
Escape special characters in strings and js code
How to escape special characters such as HTML code in Anqi CMS templates such as strings and js code? The escape filter can escape special characters in a string. For example, output HTML code to display instead of parsing HTML code. For example, &, ' and ". Will be converted to >, & will be converted to &, " will be converted to ", ' will be converted to '. It can also be made -
Split a line of text into an array by space
How to split a line of text into an array by space in Anqi CMS template? The fields filter can split a line of text into an array in a template by spaces. The defined array is a []string{}, which can be traversed in the subsequent output. Usage methods fields filter usage: {% set values = "Text content"|fields %} {% set v -
The first or last value of a string or array
How to get the first or last value of a string or array in Anqi CMS template? The first filter can obtain the first character of a string or the first value of an array. If the original string or array is empty, nothing will be returned. If the string is Chinese, the first Chinese character is returned. The last filter can get the last character of the string or the last value of the array. If the original string or array is empty, nothing will be returned. If the string is -
Floating point numbers retain the specified decimal point
How to keep a floating point number output in Anqi CMS template? The floatformat filter can preserve a floating point number with 2 decimal output. You can also keep other decimal points specified. For example, keep 3 decimal places, etc. At the same time, negative digits are supported. If the negative number is set, the calculation is forward from the last digit. Usage method floatformat How to use the filter: {{ obj|float -
Get the number at the specified position in the number
How to get the number in the specified position in the Anqi CMS template? The get_digit filter can obtain the number at the specified position in the number. The position starts from the countdown of the number to be obtained, and the starting position is 1. If the location to be retrieved does not exist, the entire number is returned. If the original number is a number, the obtained result is the number obtained by ASCII value -48 of the character at that position. How to use get_digit -
Convert a numeric string to a floating point number or an integer
How to convert a numeric string into a floating point number or integer in Anqi CMS template? The float filter can convert a numeric string to a floating point number. If the conversion fails, return 0.0. The integer filter can convert a numeric string into an integer. If the conversion fails, return 0. Usage method float filter usage method: {{ obj|float }} integer filter enable -
Link the array into strings according to the specified splice characters
How to link arrays into strings according to specified splicing characters in Anqi CMS template? The join filter can assemble the values of the array into a new string according to the specified splice link. If the original object is a string, a splicing character will be added directly to the characters and characters. Usage method join filter usage method: {{ obj|join:"split character" }} For example, you need to use ["splits", "the -
Get the length of string, array, key-value pairs
How to get the length of strings, arrays, and key-value pairs in Anqi CMS template? The length filter can get the length of string, array, key-value pairs. For a string, the number of utf8 actual characters is calculated, one letter is one, and one Chinese character is also one. Array and key-value pairs calculate their index number. You can also use length_is to calculate the length while comparing it with the input length value, and -
Convert multiple lines of text to html tags by newline characters
How to convert multiple lines of text into html tags in Anqi CMS template? The linebreaks filter can convert multiple lines of text into html tags by line breaks. Each line begins and ends with and wraps, and if there are empty lines in the middle, use . You can also use linebreaksbr to process it. The difference from linebreaks is that linebreaksbr just switches directly -
Convert phone number keyboard letters to numbers
How to convert letters of mobile phone number keyboard to numbers in Anqi CMS template? phone2numeric filters convert phone number keyboard letters into numbers. The conversion relationship is: { "a": "2", "b": "2", "c": "2", "d": "3", "e": "3", "f": "3", "g": "4", "h": "4", "i -
Plural form of words
How to convert a word into a plural form in Anqi CMS template based on quantity? The pluralize filter can convert a word into a plural form based on the number. Usage method pluralize How to use filter: {{ obj|pluralize:"plural additional words" }} pluralize requires specifying the current number and adding plural words. Supports 0 to 2 words, use when 2 words -
Return a random character and value in a string, array
How to return a random character and value in a string and array in an Anqi CMS template? The random filter can return a random character, value in a string, array. Usage method Random filter usage method: {{ obj|random }} For example, if you return any value in [1,2,3,4,5], you can write it like this: {{ "1,2,3,4,5"|split -
Remove html tags from html code
How to remove tags from html code in Anqi CMS template? The striptags filter can remove all html tags in the html code. The removetags filter can remove the specified tags in the html code. Usage method striptags How to use the filter: {{ obj|striptags }} removetags How to use the filter -
Parses HTML code and outputs without escape
How to not escape HTML code in Anqi CMS template, but parse output? The safe filter can cancel the default escape attributes of template output, allowing the html code to be directly output to the interface, and allowing the browser to parse HTML code. It is generally used in rich text output, such as displaying article details, etc. Note: Using safe filters, by default, your output is considered safe, it does not escape special characters, so if the -
Intercept elements in strings, arrays at specified positions
How to intercept elements in strings and arrays in the Anqi CMS template? The slice filter can intercept elements in strings and arrays at specified positions. For example, get an element 3 to 7 of length 10 elements. Usage method slice How to use the filter: {{obj|slice:"from:to"}} Note: use :isolated between from and to. For example, return [1, -
Strings are cut into arrays according to the specified delimiter
How to cut strings of a specific format into arrays in Anqi CMS templates according to the specified delimiter? The split filter can cut strings of a specific format into arrays by specified delimiters. If the delimiter does not exist in the string, an array of length 1 is returned, and the value of the array is the string itself. If the delimiter is empty, it will be split into an array by each utf8 character. You can also use make_list to quickly cut strings -
Format any value into string output
How to format any values such as numbers, strings, arrays, etc. into strings and output in the Anqi CMS template? The stringformat filter can format any value such as numbers, strings, arrays, etc. into string output in a specified format. Some formatting standards: %v output structure {10 30}%+v output structure display field name {one:10 tow:30}%#v output structure source -
Intercept the string or html code and add...
How to intercept and add strings or html code in Anqi CMS template...? The truncatechars filter can truncate strings and add..., which truncates words, specifying the length including... The truncatechars_html filter can intercept and add html code..., which truncates words and specifies the length including... trun -
Url parameter escape
How to escape url parameters in Anqi CMS template? The urlencode filter can escape URL parameters. The iriencode filter can escape the url parameters. Except for /#%[]=:;$&()+,!?*@'~, all characters will be escaped according to the URL parameter escape method. Usage Method Usage Usage Method Usage Usage: {{ o -
Find and parse the url string in the text into a clickable A tag
How to find and parse the url string in the text into a clickable A tag in the Anqi CMS template? The urlize filter can find and parse url strings in text into clickable a tags. The urlizetrunc filter can find and parse the url string in the text into clickable a tag, and can specify that the text displayed by the a tag can be intercepted and displayed according to the specified length. How to use urlize -
Calculate the number of words in a string
How to calculate the number of words in a string in Anqi CMS template? The wordcount filter calculates the number of words in a string. wordcount will distinguish words by spaces. If it does not contain spaces, it is counted as a word. Returns an integer. Usage method wordcount filter usage: {{ obj|wordcount }} Example demonstration {{ ""|wordco -
Automatic text wrapping
How to automatically wrap long texts in Anqi CMS templates according to the specified length? The wordwrap filter can wrap long texts automatically by specified lengths. wordwrap will distinguish words by spaces. If it does not contain spaces, it is counted as a word. Therefore, if it is a continuous Chinese word, it will not be wrapped. Usage method wordwrap How to use the filter: {{ obj|wordwrap:numbe -
Or with non-three states
How to judge or differ from three states in Anqi CMS template? The yesno filter can be used in three states. There are three default values for yesno, namely "yes", "no", and "maybe". You can also customize these three values as other values. When the value is false, no is returned, when the value is true, yes is returned, and when the value is nil, that is, null, return maybe. use -
User Details Tags
Description: Used to obtain user details data usage method: {% userDetail variable name with name="field name" id="1" %} Variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The supported parameters of userDetail are: user ID id. id is required, used to specify which one to get -
User group details tag
Description: Used to obtain user group details data usage method: {% userGroupDetail Variable name with name="field name" id="1" %} Variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The supported parameters of userGroupDetail are: user group ID id. i -
Home Banner List Tags
Description: Used to get the homepage Banner list usage method: {% bannerList variable name %} If you define a variable as banners {% bannerList banners %}...{% endbannerList %}banners is an array object, so you need to use a for loop to output item as the for loop body -
Document model details tag
Description: Used to obtain document model details data usage method: {% moduleDetail Variable name with name="field name" id="1" %} Variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The supported parameters of moduleDetail are: model ID id. id is not required, the current model will be retrieved by default. If you need to specify a model, you can achieve the purpose by setting the id or token. Model URL alias -
Template text translation tags
Description: Used for the specified text translation of the template. How to use: {%tr variable name %} The premise of using translation fields is that the template supports multilingual features. The multilingual function of a template is enabled as follows: Create the locales directory in the template directory, and then create a folder whose name is the code of the current language, such as zh-CN or zh-TW. Create a yml file in the folder, such as default.yml. The directory structure is as follows: ./locales ├── en-us │ └── -
Get multilingual site list tags
Description: Used to get a list of multilingual sites Used: {% languages variable name %} If you define a variable as websites {% languages websites %}...{% endLanguages %} languages does not support setting parameters languages will get all multilingual sites. websites is an array object, so you need to use a for loop to output item as a variable in the for loop body. -
dump filter: print the structure type and value of the variable
How to view the structure type of variables in Anqi CMS template? The dump filter can print out the structure, type, and value of a variable. Usage method dump filter usage method: {{ obj|dump }}For example, to view the structure of bannerItem, you can write this: {{ item|dump }}# Display result&config.BannerItem{Logo:"http://127.0.0.1 -
Custom content tags
Description: Used for background custom content information Usage method: {% diy variable name with name="field name" %} . The variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly. The supported parameters of DIY are siteId siteId. Generally, you do not need to fill in. If you use multi-site management in the background to create multiple sites and want to call data from other sites, you can specify siteId