Home > CMS Tutorial > Empire CMS > How does the list of Empire CMS display the number of clicks in real time? (code example)

How does the list of Empire CMS display the number of clicks in real time? (code example)

青灯夜游
Release: 2020-12-22 10:21:13
forward
3731 people have browsed it

The following article will introduce to you how Empire CMS displays the number of clicks in a list in real time. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How does the list of Empire CMS display the number of clicks in real time? (code example)

Related recommendations: "Empire cms tutorial"

Empire CMS list display and real-time display of clicks

1. Browse: [!--onclick--] times

2. Add Jquery code

<script>
window.onload = function(){
$('.clicknum').each(function(i){
//列表中所有的新闻点击数标签
var url="[!--news.url--]e/public/ViewClick?&down=0&nojs=1&classid="+$(this).attr("data-class")+"&id="+$(this).attr("data-id");
$(this).load(url);
});
}  
</script>
Copy after login

3. Modify the end of /e/public/ViewClick/index.php

$nojs=(int)$_GET['nojs'];
//参数判断输出方式 1=直接输出数字 0=JS输出
if ($nojs==1){
	echo $shownum;
}else{
	echo"document.write('".$shownum."');";
}
Copy after login

For more programming-related knowledge, please visit: Programming Teaching! !

The above is the detailed content of How does the list of Empire CMS display the number of clicks in real time? (code example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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