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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 English version
Recommended: Win version, supports code prompts!
