Destoon Official Label Daquan One, what is a label call? The label call is to read the call quantity (pagesize) bar data from the Data table (table) according to the invocation criteria (condition) and sort by sort (order), eventually outputting the data through the layout of the label 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, the Label function prototype tag function is saved in include/tag.func.php
- Tag ($parameter, $expires = 0)
- $parameter A string that is passed to the tag function, the system automatically converts it to multiple variables
Copy CodeFor example, passing a table=destoon&pagesize=10&hello=world system is equivalent to getting:
- $table = ' Destoon ';
- $pagesize = 10;
- $hello = ' world ';
Copy CodeThree variables $expires indicates that the tag cache expires >0 cache $expires seconds, 0– system default tag cache time, -1– does not cache, -2– caches SQL results, and general conditions do not need to be passed by default. Third, the data reading process such as the following tags:
-
Copy Codewill be converted to the following SQL statement:
- SELECT *
- From Destoon_sell
- WHERE status=3
- ORDER by Addtime DESC
- LIMIT 0,10
Copy CodeThe data that is read is saved in the $tags array. Four, the data display procedure 1, through the label template display pass &TEMPLATE=ABC to the label function, for example:
-
Copy CodeThis notation passes the label template null, and returns the data directly to the $tags array, where the following is a complete example that can be looped directly in the template:
-
- {Loop $tags $t}
- ...
- {/loop>
Copy CodeThe first one is generally used for multiple invocations of data, and the second is typically used for data that is called only once. Five, common parameters and meaning Moduleidmoduleid refers to the module ID, can be in the Background module management query. For directly invoking the module's data, after setting the correct module ID, the table parameter will not be passed, and the system will get it automatically. For example, by passing moduleid=5, the system will recognize the call provisioning information and automatically set the table parameter to sell Tabletable refers to the name of the table, can be queried in the background database maintenance. For Destoon system tables, there is no need to prefix the table, and for non-destoon system tables, complete table names are required, and prefix parameters such as Destoon system tables are passed Table=sell, if the table prefix is destoon_, the system will recognize the table named Destoon_sell for non-destoon system tables, passing table=tb_abc&prefix= or table=abc&prefix=tb_, the system will recognize the table named TB_ABC Fieldsfields refers to the field of the query, which defaults to *. such as Fields=title,addtime can be passed, but in general there is no need to pass, and Destoon's unique tag caching mechanism automatically caches query results without worrying about efficiency issues. Conditioncondition refers to the condition of the query, or 1 if not passed, which represents the data for any condition (this item needs to know the SQL syntax). Destoon all modules are developed in accordance with unified standards, so many conditions are common. For example, status=3 indicates that the information passed normally, status=3 and level=1 represent a level 1 information, status=3 and thumb<> "represent information such as a caption picture. Orderorder refers to the sorting method of the data (this item requires an understanding of SQL syntax). For example Order=addtime desc means descending by add time, Order=itemid desc means descending by itemid, Order=rand () representing random data, and so on. Pagesizepagesize refers to the number of call data, which, if not passed, defaults to 10. Templatetemplate refers to the specified label template, if not passed, the default is list, located in the template directory/tag/list.htm, if passed to null, indicates that the label template is not applied. See the data display procedure above. Six, other common usage example 1), multi-table joint query for example, to inquire members and company information 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 is the actual name of the table (including the table prefix), prefix= "indicates that the system is no longer automatically prefixed with the table name 2), control the length of the title in the label pass the length parameter, for example, &length=20 represents 20 character length (one kanji is 2 characters), it is generally recommended to hide extra characters with CSS (define height and Overflow:hidden) Pass the length parameter, the system only automatically intercepts the title field, if you need to intercept other fields, you can use the DSUBSTR function such as {DSUBSTR ($t [Company], 20, ' ... ')} to intercept the company field as 20 characters, after interception, the end is appended ... 3), set the date display format can be passed in the label Datetype parameters: 1 for the year, 2 for the month-day, 3 for the year-month-day, 4 for the month-day time: minute; 5 means year-month-day time: minute; 6 indicates year-month-day: minutes: Seconds You can also use the DATE function directly in Date (' y-m-d ', $t [Addtime])} represents converting time to year-month-day format The information that invokes a taxonomy passes the CATID parameter in the label, such as &catid=5, which represents all information that invokes the class ID of 5. If multiple classifications are called, separate the classification IDs with commas, for example &catid=5,6,7 for all information that calls the class ID 5, 6, 7. The classification call contains the information for the subcategory by default, and you can set the &child=0 parameter if you do not need to include a subcategory. For example, &catid=5&child=0 indicates that only the information for the class ID 5 is called, not the subcategory. Call the information of a region call the region information and the method of the above call classification information exactly the same, the CATID of which can be changed to Areaid. Show information in the category
- {$CATEGORY [$t [Catid]][catname]}
Copy CodeControl number of columns this item is commonly used for the layout of pictures, which can be used with the cols parameter. For example, call 12 pictures, one row shows 4, a total of 3 rows, then pass &pagesize=12&cols= 4 support cols parameter label template Limited thumb-table.htm and list-table.htm which, thumb-table.htm display a list of pictures, list-table.htm display text list If you create a new support cols label template or direct loop $ tags, can refer to the above two templates to write the above effects can also be implemented through CSS, without the use of tables, please make your own Show an introduction to the article use {$t [introduce]} variable, if you want to intercept words, such as 80 characters, you can use {dsubstr ($t [introduce], 80, ' ... ')} Function prototype tag ($parameter, $expires = 0) $parameter represents a string passed to the tag function, the system automatically converts it to multiple variables such as passing table=destoon&pagesize=10, the system is equivalent to getting $ Table = ' Destoon '; $pagesize = 10; Two variable $expires indicates cache expiration >0 cache $expires seconds, 0– system default time, -1– does not cache, -2– cache SQL, and general conditions remain default. Constant {Dt_skin} system style URL. {dt_path} website homepage URL. The variable $tags holds the data of the tag invocation in an array type, which can be traversed through the loop syntax. $pages Save the data paging code, only valid when paging is called. $MODULE [5][name]id is 5 module name. $MODULE [5][linkurl]id is a 5 module URL. $CATEGORY [5][catname]id is a class name of 5 (valid only if the variable $category exists). $CATEGORY [5][linkurl]id is a 5 classified URL (valid only if the variable $category exists). Characters commonly used section title title; Linkurl link; catid category ID; introduce introduction; Addtime add time; common function dsubstr ($string, $length, $suffix = ") string $string intercept $length long, trailing append $suffix (e.g..) Date ($format, $timestamp) converts timestamp $timestamp to $format (for example, y-m-d) format The label template template is saved in the./template/default/tag/directory, it is recommended that you do not delete or modify your own templates, and recommend that you create a new template and apply it on your own template. 1. The general description of the label format moduleid=9 is the information module ID, module ID to the module management view; Article is the directory name of the information module; &length=40 is the number of tags to intercept &pagesize=10 is the count of calls & Datetype=2 is display time add time 2. Call the latest join Enterprise 4&pagesize=10&order=userid desc&template=list-com ")}–>3. How to call one of the business members of the supply and demand information in condition= Riga and username= ' xxx '? XXX is the member login name 4. How to invoke the information under a classification call category under the supply of a purchase product can be set &catid= industry id&child=1 child=1 represents the same call to the subordinate industry 5. Call the Level two column information list If you are in the article module call can use the above code $catid instead of the column ID you want to call, if you need to call the information under the column child=1 can otherwise child=0 if it is called elsewhere in the site, you can use the following code: Note that the value of ModuleID is consistent with the module ID that you call Add: The following is successful on the first page but I want a template list inside the page, that is, only 22 words per bar. 6. Home Information column Here's how to call "9" for your module ID
- {php $C = get_maincat (0, Cache_read (' category-9.php '));}
- {Loop $C $k $v}
- {$v [catname]}
- {/loop}
Copy Code7. List of companies can not control the number of words!! You can modify list-com.htm directly
- {$t [Company]} is {dsubstr ($t [Company], $length)}
Copy Code8.TAG Common Tags
- {$CATEGORY [$t [catid]]["CatName"]} belongs to the column name; {timetodate ($t ["Addtime"], $datetype)}? Release time
Copy Code9. Other you can specify the label template by &template= If this parameter is not used by default, the list is located in the template directory tag directory level 1 for the recommended article; 2 is a slideshow, 3 is the recommended graphic; 4 is the headline; Level 5 is headline-related. The above is Destoon official label of the entire content, we can collect, in the use of Destoon station, many times will be used. Recommended Reading:Destoon Introductory Tutorials and tips examples |