Home > CMS Tutorial > Empire CMS > body text

How to call the download ranking of Empire CMS

藏色散人
Release: 2019-12-06 09:21:43
Original
2553 people have browsed it

How to call the download ranking of Empire CMS

How does Empire CMS call the download ranking?

The example in this article describes the method of calling the download ranking by Empire CMS. Share it with everyone for your reference. The specific analysis is as follows:

It is recommended to study "Empire cms tutorial"

Implementation method:

The first step: in the data Add three fields to the table: DayHits WeekHits MonthHits. Set the field type to INT

. Step 2: Open the file:/e/public/ViewClick/index.php, add the following code after //digg click number. .

The code is as follows:

//日下载数 
elseif($down==7) 
{ 
$r=$empire->fetch1("select DayHits from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1"); 
$shownum=$r['DayHits']; 
} 
//周下载数 
elseif($down==8) 
{ 
$r=$empire->fetch1("select WeekHits from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1"); 
$shownum=$r['WeekHits']; 
} 
//月下载数 
elseif($down==9) 
{ 
$r=$empire->fetch1("select MonthHits from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1"); 
$shownum=$r['MonthHits']; 
}
Copy after login

Step 3: Open /e/class/DownSysFun.php and find, //The total download data is increased by one.

The code is as follows:

$usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set totaldown=totaldown+1where id='$id'"); 
//替换成: 
$usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set totaldown=totaldown+1,DayHits=DayHits+1,WeekHits=WeekHits+1,MonthHits=MonthHits+1 where id='$id'");
Copy after login

Step 4: Content page call:

Today’s download:

The code is as follows:

<script src=[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]&down=7></script>
Copy after login

This week’s download:

code As follows:

<script src=[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]&down=8></script>
Copy after login

Download this month:

The code is as follows:

<script src=[!--news.url--]e/public/ViewClick/?classid=[!--classid--]&id=[!--id--]&down=9></script>
Copy after login

Step 5:

Add a new scheduled task to the background scheduled task.

Task name: Daily download clearing program

Select the time as 0 o'clock or 1 o'clock, it's up to you.

The php file code is as follows:

The code is as follows:

<?php 
$usql=$empire->query("update {$dbtbpre}ecms_download set DayHits=0"); //不同的数据表,自己修改下,我用的是下载模型。所以是 download 
?>
Copy after login

Add a new weekly download and clear it

The code is as follows:

<?php 
$usql=$empire->query("update {$dbtbpre}ecms_download set WeekHits=0"); 
?>
Copy after login

Add a new monthly download and clear it:

The code is as follows:

<?php 
$usql=$empire->query("update {$dbtbpre}ecms_download set MonthHits=0"); 
?>
Copy after login

That’s it!

The above is the detailed content of How to call the download ranking of Empire CMS. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!