How to add the like function to the homepage list page of Empire CMS

php中世界最好的语言
Release: 2017-12-30 17:57:32
Original
2516 people have browsed it

What I will show you this time is how to add the like function on the homepage list page of Empire CMS. The Empire CMS template is very easy to use. If you want to add some functions you need based on the template, how should you implement it? This article will give you a good analysis.

Check the content page template code of the news system of the empire cms website building program and find the HTML code block for the likes, as shown below:

来顶一下
Copy after login

It can be seen from the above code that the current total number of likes is passed The dynamic script loading method produces real-time output, and the makeRequest() function on the a tag is used to implement the like function. The first parameter of the makeRequest() function is the request address and accompanied by parameter data. The second parameter is thecallback functionname executed after a successful request. The third parameter specifies sending the request in GET mode. After understanding the implementation principle, it is easy to implement the like (like) function on other pages of the website. The relevant code for the implementation method is given below.

For example, if we need to implement the like function on the product list template page, we first need to modify the code of the product list template. The following is my modified list template code:

List content template (list.var)

$nomar=""; if($no%4==0){$nomar=" class=\"nomar\"";}else{$nomar="";} if($r[titlepic]){$tpic=sys_ResizeImg($r[titlepic],300,300,1,"");}else{$tpic="/e/data/images/notimg.gif";} $listtemp='

查看
详情

[!--title--]([!--model--]) [!--diggtop--]人赞过'; 最后在底部模板里或JS文件中加入以下js代码,大功告成 [html] view plain copy print?
Copy after login

I believe you have mastered the method after reading the above introduction. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to use vue to implement login verification

js to achieve the imitation window system calendar effect

How can JS click to jump to the logged-in personal mailbox

The above is the detailed content of How to add the like function to the homepage list page 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
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!