這篇教程為大家帶來了帝國CMS點贊點踩示例代碼教程,希望對大家有所幫助!
1、首先需要你參考帝國CMS默認點贊字段再新建一個點踩的字段。
2、在需要點贊的模板頁面加載AJAX插件
<script src="[!--news.url--]e/data/js/ajax.js"></script>
示例代碼
<a href="JavaScript:makeRequest(\'/e/public/digg?classid='.$r[classid].'&id='.$r[id].'&dotop=0&doajax=1&ajaxarea=diggdown'.$r[id].'\',\'EchoReturnedText\',\'GET\',\'\');" class="like fall"> <label class="num">利空 <em id="diggdown'.$r[id].'" style="font-style:normal"><script src=/e/public/ViewClick?classid='.$r[classid].'&id='.$r[id].'&down=6></script></em></label> </a> <a href="JavaScript:makeRequest(\'/e/public/digg?classid='.$r[classid].'&id='.$r[id].'&dotop=1&doajax=1&ajaxarea=diggnum'.$r[id].'\',\'EchoReturnedText\',\'GET\',\'\');" class="like rose"> <label class="num">利好 <em id="diggnum'.$r[id].'" style="font-style:normal"><script src=/e/public/ViewClick?classid='.$r[classid].'&id='.$r[id].'&down=5></script></em></label> </a>