Home > Article > Backend Development > What are the official labels of destoon? destoon official label collection
destoon official tag collection First, what is tag calling? Tag calling is to read the calling number (pagesize) of data from the data table (table) according to the calling condition (condition), sort it by the sorting method (order), and finally output the data through the layout of the tag template. It can be seen that the work of the label is divided into two parts, one is to read the data, and the other is to display the data. Second, label function prototype Tag functions are stored in include/tag.func.php
For example, pass table= destoon&pagesize=10&hello=world The system is equivalent to getting:
Three variables $expires means that the tag cache expiration time is >0 and caches $expires seconds; 0 - the system default tag cache time; -1 - no caching; -2 - cache SQL results; In general, keep the default value and do not need to pass it. 3. Data reading process For example, the following tags: will be converted into the following SQL statement:
The read data will be saved in the $tags array. 4. Data display process 1. Display through label template Pass &template=abc to the label function, for example: This way of writing passes the tag template as null and returns it directly The data is given to the $tags array. At this time, you can directly loop in the template. Here's a complete example:
The first way of writing is generally used for data that is called multiple times, and the second way of writing is generally used for data that is called only once. Five, commonly used parameters and their meanings moduleid moduleid refers to the module ID, which can be queried in the background module management. For data that directly calls the module, after setting the correct module ID, there is no need to pass the table parameter, and the system will automatically obtain it. For example, if moduleid=5 is passed, the system will recognize it as calling supply information and automatically set the table parameter to sell table table refers to the table name, which can be queried in the background database maintenance. For Destoon system tables, there is no need to add a table prefix; for non-Destoon system tables, you need to fill in the complete table name and pass the prefix parameter. For example, for the Destoon system table, pass table=sell. If the table prefix is destoon_, the system will recognize the table name as destoon_sell. For non-Destoon system tables, pass table=tb_abc&prefix= or table=abc&prefix=tb_, the system will recognize the table name as tb_abc fields fields refers to the query field, the default is *. For example, fields=title,addtime can be passed, but generally there is no need to pass it. Destoon's unique tag caching mechanism will automatically cache the query results, so there is no need to worry about efficiency issues. condition condition refers to the condition of the query. If not passed, it is 1, which represents the data of any condition (you need to understand SQL syntax for this item). All Destoon modules are developed according to unified standards, so many conditions are common. For example, status=3 indicates information that passed normally, status=3 and level=1 indicates information with level 1, status=3 and thumb” indicates information with a title picture, etc. order Order refers to the sorting method of data (this requires understanding of SQL syntax). For example, order=addtime desc means to sort by adding time in descending order, order=itemid desc means to sort by itemid in descending order, order=rand() means random data, etc. pagesize pagesize refers to the number of calling data. If not passed, the default is 10. template Template refers to the specified tag template. If not passed, the default is list, which is located in the template directory/tag/list.htm. If passed as null, it means that the tag template is not applied. See the above data display process. Six, other common usage examples 1), Multi-table joint query For example, to query the member and company information of the member named destoon, you can use: {tag(“table=destoon_member m,destoon_company c&prefix=”&condition=m.userid=c.userid and m.username=’destoon’&template=list-com”)} destoon_member and destoon_company are the actual names of the tables (including the table prefix), prefix=" means that the system will no longer automatically add a prefix to the table name 2), control title length Pass the length parameter in the tag. For example, &length=20 means 20 characters in length (one Chinese character occupies 2 characters). Generally, it is recommended to use CSS to hide extra characters (define height and overflow: hidden). Pass the length parameter, and the system will automatically intercept only the title field. If you need to intercept other fields, you can use the dsubstr function. For example, {dsubstr($t[company], 20, ‘…’)} means that the company field is intercepted to 20 characters. After interception, append... to the end.3), set date display format You can pass the datetype parameter in the tag: 1 represents year; 2 means month-day; 3 means year-month-day; 4 means month-day hour: minute; 5 means year-month-day hour: minute; 6 means year-month-day hour:minute:second You can also use the date function directly in the template, for example {date(‘Y-m-d', $t[addtime])} means converting the time into year-month-day format Call information of a certain category Pass the catid parameter in the tag, for example &catid=5 means calling all information with category ID 5. If calling multiple categories, separate the category IDs with commas. For example, &catid=5,6,7 means calling all information with category IDs 5, 6, and 7. Category calls include subcategory information by default. If you do not need to include subcategories, you can set the &child=0 parameter. For example, &catid=5&child=0 means that only the information with category ID 5 is called, excluding the information of subcategories. Call information about a certain region The method of calling regional information is exactly the same as the above method of calling classified information. Just replace catid with areaid. Display the category where the information is located
Copy code
Control the number of columns This item is often used for image layout and can use the cols parameter. For example, if 12 pictures are called and 4 are displayed in one line, with a total of 3 lines, then &pagesize=12&cols=4 is passed. Tag templates that support the cols parameter are limited to thumb-table.htm and list-table.htm. Among them, thumb-table.htm displays the picture list, and list-table.htm displays the text list. If you create a new tag template that supports cols or directly loop $tags, you can refer to the writing methods of the above two templates. The above effects can also be achieved through CSS. There is no need to use a table. Please write it by yourself Show the introduction of the article Use the {$t[introduce]} variable. If you want to intercept the number of words, for example, 80 characters, you can use {dsubstr($t[introduce], 80, ‘…’)} Function prototype tag($parameter, $expires = 0) $parameter represents the string passed to the tag function, and the system automatically converts it into multiple variables For example, passing table=destoon&pagesize=10, the system is equivalent to getting $table = ‘destoon’; $pagesize = 10; two variables $expires represents cache expiration time >0 caches $expires seconds; 0 - system default time; -1 - no cache; -2 - cache SQL; generally keep the default. Constant {DT_SKIN} System style URL. {DT_PATH} Website homepage URL. Variables $tags Save the data called by the tag in an array type, which can be traversed and displayed through loop syntax. $pages Save data paging code, only valid when paging is called. $MODULE[5][name] The name of the module with ID 5. $MODULE[5][linkurl] Module URL with ID 5. $CATEGORY[5][catname] Category name with ID 5 (valid only when variable $CATEGORY exists). $CATEGORY[5][linkurl] Category URL with ID 5 (valid only when variable $CATEGORY exists). Commonly used fields title title; linkurl link; catid category ID; introduce introduction; addtime addition time; commonly used functions dsubstr($string, $length, $suffix = ”) Truncate the string $string to $length and append $suffix at the end (for example..) date($format, $timestamp) Convert timestamp $timestamp to $format (for example Y-m-d) format Label template Templates are saved in the ./template/default/tag/ directory; It is recommended not to delete or modify the built-in templates. It is recommended to create a new template based on the built-in templates and apply them. 1. General description of label format moduleid=9 is the information module ID. Go to module management to view the module ID; article is the directory name of the information module; &length=40 is the number of characters intercepted by the label &pagesize=10 is the number of calls &datetype=2 is to display time and add time 2. Call the latest company to join 4&pagesize=10&order=userid desc&template=list-com”)}–> 3. How to call the supply and demand information and information of one of the corporate members In condition=Riga and username='xxx'? xxx is the member login name 4. How to call a certain category under Supply Purchasing Products The information under the calling category can be set &catid=industry id&child=1 child=1 means calling the subordinate industry at the same time 5. Call the secondary column information list If you are calling in the article module, you can use the above code to change $catid to the column id you want to call. If you need to call the information under the column at the same time, child=1, otherwise child=0 If it is called elsewhere on the website, you can use the following code: Note that the value of moduleid must be consistent with the module id you call Added: The following is successfully called on the homepage But I want the template list inside the information page, that is, each item only displays 22 characters. 6. How to call the information section on the home page? "9" is the ID of your module
7. Company lists cannot control the word count! ! You can modify list-com.htm directly
8.TAG Commonly used tags
9.Others You can specify the label template via &template= If this parameter is not used, the default is list. Located in the template directory tag directory Information level level 1 is recommended articles; level 2 is slideshow pictures; level 3 is recommended pictures and texts; level 4 is headline articles; level 5 is headlines related The above is the entire content of the destoon official tag. You can save it. It will be used many times when using destoon to build a website. Recommended reading: destoon introductory tutorials and skill examples |