Imperial CMS implementation calls the method of downloading ranking
This article mainly introduces the Imperial CMS implementation call download ranking method, the article is very detailed, has a certain reference value, interested friends must read it!
How does Imperial CMS call download ranking?
Implementation method:
Step 1: add three fields to the data table: DayHits WeekHits MonthHits is set to field type INT
Step 2: open the file: / eCompact ViewClick.index.phpMagnediDGN add the following code after the stamping number.
The code is as follows:
/ / the number of daily downloads elseif ($down==7) {$ritual download empires-> fetch2 ("select DayHits from {$dbtbpre} ecms_". $cr ['tbname']. " Where id='$id' limit 1 "); $shownum=$r ['DayHits'];} / / number of weekly downloads elseif ($down==8) {$rattled empires-> fetch2 (" select WeekHits from {$dbtbpre} ecms_ ". $cr [' tbname']." Where id='$id' limit 1 "); $shownum=$r ['WeekHits'];} / the number of monthly downloads elseif ($down==9) {$rusted download empires-> fetch2 (" select MonthHits from {$dbtbpre} ecms_ ". $cr [' tbname']." Where id='$id' limit 1 "); $shownum=$r ['MonthHits'];}
Step 3: open / e/class/DownSysFun.php to find, / / total download data increase one.
The code is as follows:
$usql=$empire- > query ("update {$dbtbpre} ecms_". $class_r [$classid] [tbname]. "set totaldown=totaldown+1where id='$id'"); / / replace with: $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: the content page calls:
Download today:
The code is as follows:
Download this week:
The code is as follows:
Download this month:
The code is as follows:
Step 5:
A new scheduled task is added to the background scheduled task.
Task name: daily download clearance program
It's up to you to choose the time of 0: 00 or 1: 00.
The php file code is as follows:
The code is as follows:
Add new weekly downloads and empty them.
The code is as follows:
Add a new month to download and clear:
The code is as follows:
These are all the contents of the Imperial CMS implementation that calls the download ranking method. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!