|
★★使用步骤:
1.上传相应版本(gbk2312或utf-8)的digg_ajax.php文件到网站根目录plus文件夹下覆盖原文件
2.找到内容页模板文件(默认是article_article.htm),在</head>之前粘贴以下代码:
<!-- 点赞引用 start -->
<script language="javascript" type="text/javascript" src="{dede:global.cfg_cmsurl/}/include/js/dedeajax2.js"></script>
<script language="javascript" type="text/javascript">
<!--
function postBadGood(ftype,fid)
{
var taget_obj = document.getElementById(ftype+fid);
var saveid = GetCookie('badgoodid');
if(saveid != null)
{
var saveids = saveid.split(',');
var hasid = false;
saveid = '';
j = 1;
for(i=saveids.length-1;i>=0;i--)
{
if(saveids==fid && hasid) continue;
else {
if(saveids==fid && !hasid) hasid = true;
saveid += (saveid=='' ? saveids : ','+saveids);
j++;
if(j==10 && hasid) break;
if(j==9 && !hasid) break;
}
}
if(hasid) { alert('淘气,您已表决过了!'); return false;}
else saveid += ','+fid;
SetCookie('badgoodid',saveid,1);
}
else
{
SetCookie('badgoodid',fid,1);
}
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajax.SendGet2("{dede:global.cfg_cmsurl/}/plus/feedback.php?aid="+fid+"&action="+ftype+"&fid="+fid);
}
function postDigg(ftype,aid)
{
var taget_obj = document.getElementById('newdigg');
var saveid = GetCookie('diggid');
if(saveid != null)
{
var saveids = saveid.split(',');
var hasid = false;
saveid = '';
j = 1;
for(i=saveids.length-1;i>=0;i--)
{
if(saveids==aid && hasid) continue;
else {
if(saveids==aid && !hasid) hasid = true;
saveid += (saveid=='' ? saveids : ','+saveids);
j++;
if(j==20 && hasid) break;
if(j==19 && !hasid) break;
}
}
if(hasid) { alert("淘气,您已表决过了!"); return; }
else saveid += ','+aid;
SetCookie('diggid',saveid,1);
}
else
{
SetCookie('diggid',aid,1);
}
myajax = new DedeAjax(taget_obj,false,false,'','','');
var url = "{dede:global.cfg_cmsurl/}/plus/digg_ajax.php?action="+ftype+"&id="+aid;
myajax.SendGet2(url);
}
function getDigg(aid)
{
var taget_obj = document.getElementById('newdigg');
myajax = new DedeAjax(taget_obj,false,false,'','','');
myajax.SendGet2("{dede:global.cfg_cmsurl/}/plus/digg_ajax.php?id="+aid);
DedeXHTTP = null;
}
-->
</script>
<!-- 点赞引用 end -->
3.在内容页找到适合(需要放置“点赞”)的位置,粘贴上以下代码:
第一种代码(纯文字点赞形式):
<span id="newdigg"><i class="iconfont">♡</i> 点赞 ({dede:field.goodpost/})</span>
第二种代码(图文点赞形式):
<!-- //点赞 -->
<div class="newdigg" id="newdigg">
<div class="diggbox digg_good">
<div class="digg_act">赞</div>
<div class="digg_num">({dede:field.goodpost/})</div>
</div>
<div class="diggbox digg_bad">
<div class="digg_act">踩</div>
<div class="digg_num">({dede:field.badpost/})</div>
</div>
</div>
<script language="javascript" type="text/javascript">getDigg({dede:field.id/});</script>
<!-- //点赞部份的源码结束 -->
链接:https://pan.baidu.com/s/1P-Ki7c-NVcOW-kHgXjC_Gg
提取码:aymf
|
|