Home  >  Article  >  CMS Tutorial  >  The usage of ecms smart tag e:loop is to obtain the required records by executing sql

The usage of ecms smart tag e:loop is to obtain the required records by executing sql

silencement
silencementforward
2019-11-30 13:08:252694browse

The usage of ecms smart tag e:loop is to obtain the required records by executing sql

Under certain conditions, we require specified information to be displayed on a certain page of the website.

However, if this specification is hard-coded, it will not work. Future changes will be a big trouble;

At this time, the advantages of sql statements are highlighted. Using sql statements, you only need to change the numbers to completely replace the displayed content;
Recommended to learn "Empire cms tutorial

The code is as follows:

[e:loop={'select * from phome_ecms_news where id in (2452,2697,2299,2267)',4,24,0}]
<li><a href="<?=$bqsr[&#39;titleurl&#39;]?>">
<?=esub($bqr[title],28)?>
</a><span></span></li>
[/e:loop]

According to the specification of the sql statement, return the content information with ID numbers 2452, 2697, 2299, 2267, and the code behind The penultimate parameter is 24,
This is the execution of sql.
(The following content comes from the Internet to explain the usage of smart tags)
Instructions for using smart tags:
Smart tag (e:loop)
Format:
[e:loop={column ID/ Topic ID, display number, operation type, only display pictures with titles, additional SQL conditions, display sorting}]
Template code content
[/e:loop]
Example:

The code is as follows:

[e:loop={栏目ID/专题ID,显示条数,操作类型,只显示有标题图片,附加SQL条件,显示排序}]
<tr>
<td>
<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a> (<?=date(&#39;Y-m-d&#39;,$bqr[newstime])?>)
</td>
</tr>
[/e:loop]

The specific operation type description is as follows:
Operation type description
0 Latest in each column
1 Popular in each column
2 Recommended in each column
9 Each column Comment ranking
12 Headline information of each column
15 Download ranking of each column
25 Rating ranking of each column
26 Voting ranking of each column
3 All information latest (default table)
4 All Popular information (default table)
5 All information recommendations (default table)
10 All information comment rankings (default table)
13 All information headlines (default table)
16 All information download rankings (default table) Table)
27 All information rating ranking (default table)
28 All information voting ranking (default table)
6 Topic latest information
7 Topic hot information
8 Topic recommendation information
11 Topic comment ranking
14 Topic headline
17 Each topic download ranking
29 Each topic rating ranking
30 Each topic voting ranking
18 Each table is the latest (column ID='table name')
19 Popularity of each table (column ID='table name')
20 Recommendation of each table (column ID='table name')
21 Comment ranking of each table (column ID='table name')
22 Headline information of each table (column ID='table name')
23 Download ranking of each table (column ID='table name')
31 Rating ranking of each table (column ID='table name')
32 Voting ranking of each table (column ID='table name')
24 Query by sql (column ID='sql statement')
The data table prefix is ​​available: "[!db.pre!]" express

The above is the detailed content of The usage of ecms smart tag e:loop is to obtain the required records by executing sql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:www.word666.com/cms/. If there is any infringement, please contact admin@php.cn delete