Home > CMS Tutorial > Empire CMS > How does ecms obtain the required records by executing sql?

How does ecms obtain the required records by executing sql?

藏色散人
Release: 2019-12-07 09:13:19
Original
2254 people have browsed it

How does ecms obtain the required records by executing sql?

How does ecms obtain the required records by executing sql?

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

Under certain conditions, we require that it be displayed on a certain page of the website Specified information,

It is recommended to study "Empire cms Tutorial"

But if this kind of specification is hard-coded, the future changes will be huge. 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;

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]
Copy after login

According to the specification of the sql statement, return the content information with ID numbers 2452, 2697, 2299, 2267 respectively. At the same time, the penultimate parameter behind the code 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 tags (e:loop)

Format:

[e:loop={栏目ID/专题ID,显示条数,操作类型, 只显示有标题图片,附加SQL条件,显示排序}] 
模板代码内容 
[/e:loop]
Copy after login

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]
Copy after login

The specific operation type description is as follows:

Operation type description

0 Each column Latest

1 Popular in each column

2 Recommended in each column

9 Comment ranking in each column

12 Headline information in 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 information popular (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)

27 All information rating rankings (default table)

28 All information voting rankings (default table)

6 Special topics Latest information

7 Topic hot information

8 Topic recommendation information

11 Topic comment ranking

14 Topic headlines

17 Each topic Download Ranking

29 Rating Ranking of Each Topic

30 Voting Ranking of Each Topic

18 Latest Each Table (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 Each table Rating ranking (column ID='table name')

32 Voting ranking of each table (column ID='table name')

24 Query by sql (column ID='sql statement')

Data table prefix is ​​available: "[!db.pre!]" means

The above is the detailed content of How does ecms obtain the required records by executing sql?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template