Home  >  Article  >  CMS Tutorial  >  How to call the download ranking of Empire CMS

How to call the download ranking of Empire CMS

藏色散人
藏色散人Original
2019-12-06 09:21:432561browse

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']; 
}

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'");

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>

This week’s download:

code As follows:

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

Download this month:

The code is as follows:

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

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 
?>

Add a new weekly download and clear it

The code is as follows:

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

Add a new monthly download and clear it:

The code is as follows:

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

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!

Statement:
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