花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來(lái)到素材無(wú)憂網(wǎng),按 + 收藏我們
登錄 注冊(cè) 退出 找回密碼

織夢(mèng)列表頁(yè),支持頂(贊)和踩的功能,頂過(guò)后標(biāo)紅高亮顯示

時(shí)間: 2018-12-06 11:51 閱讀: 作者:素材無(wú)憂網(wǎng)

模板

<script language="javascript" type="text/javascript">  
function postDigg(ftype,aid)   
{
    var taget_obj = document.getElementById('diggNum'+aid);   
    
    var saveid = GetCookie('diggid');   //我所有贊過(guò)的文章id
    //alert(saveid);
    if(saveid != null)   
    {
        var saveids = saveid.split(',');   
        var hasid = false;   
        saveid = '';   
        j = 1;   
        for(i=saveids.length-1;i>=0;i--)   
        {
            if(saveids[i]==aid && hasid) continue; //我頂過(guò)  
            else {   
                if(saveids[i]==aid && !hasid) hasid = true;   
                saveid += (saveid=='' ? saveids[i] : ','+saveids[i]);   
                j++;   
                if(j==20 && hasid) break;   
                if(j==19 && !hasid) break;   
            }   
        }   
        if(hasid) {
        //alert("您已經(jīng)頂過(guò)該帖,請(qǐng)不要重復(fù)頂帖 !");
        //如果點(diǎn)擊后,被贊過(guò).則不需要更新統(tǒng)計(jì),直接改變顏色
        $('#digg'+aid).addClass("icon-heart-on");
        return; 
        }   
        else saveid += ','+aid;   
        SetCookie('diggid',saveid,1);  
        
    }   
    else   
    {   //如果cookie中無(wú)記錄,則記錄
        SetCookie('diggid',aid,1); 
        
    }   
    myajax = new DedeAjax(taget_obj,false,false,'','','');   
    var url = "{dede:global.cfg_phpurl/}/digg_ajax_list.php?action="+ftype+"&id="+aid;   
    myajax.SendGet2(url); 
    
    DedeXHTTP = null;  
}   

</script> 

{dede:arclist row='6' orderby='id' titlelen='100'}

 <span  id="diggNum[field:id/]">&nbsp;<a href="javascript:"class=" text-bbb text-16" onclick="javascript:postDigg('good',[field:id/])"><span id="digg[field:id/]" class="icon-heart2 ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;</a>[field:goodpost/] 
</span>  
{/dede:arclist}

css

.icon-heart2{
    background: url(../images/bg-main.png) -22px 5px no-repeat;
}
.icon-heart2:hover{
    background: url(../images/bg-main.png) 2px 4px no-repeat;
}
.icon-heart-on{
    background: url(../images/bg-main.png) 2px 4px no-repeat;
}

然后在,plus中新建立一個(gè)digg_ajax_list.PHP文件,內(nèi)容為
 

<?php   
   
require_once(dirname(__FILE__)."/../include/common.inc.php");   
  
$action = isset($action) ? trim($action) : '';   
$id = empty($id)? 0 : intval(preg_replace("/[^\d]/",'', $id));   
  
if($id < 1)   
{   
    exit();   
}   
$maintable = 'archives';   
if($action == 'good')   
{   
    $dsql->ExecuteNoneQuery("Update `$maintable` set scores = scores + {$cfg_caicai_add},goodpost=goodpost+1,lastpost=".time()." where id='$id'");   
}   
else if($action=='bad')   
{   
    $dsql->ExecuteNoneQuery("Update `$maintable` set scores = scores - {$cfg_caicai_sub},badpost=badpost+1,lastpost=".time()." where id='$id'");   
}   
$digg = '';   
$row = $dsql->GetOne("Select goodpost,badpost,scores From `$maintable` where id='$id' ");   
if(!is_array($row))   
{   
    exit();   
}   
if($row['goodpost']+$row['badpost'] == 0)   
{   
    $row['goodper'] = $row['badper'] = 0;   
}   
else  
{   
    $row['goodper'] = number_format($row['goodpost']/($row['goodpost']+$row['badpost']),3)*100;   
    $row['badper'] = 100-$row['goodper'];   
}   
  
if(empty($formurl)) $formurl = '';   
if($formurl=='caicai')   
{  
    if($action == 'good') $digg = $row['goodpost'];   
    if($action == 'bad') $digg  = $row['badpost'];   
}   
else  
{   
    $row['goodper'] = trim(sprintf("%4.2f", $row['goodper']));   
    $row['badper'] = trim(sprintf("%4.2f", $row['badper']));       
    $digg = '<a  class=" text-bbb text-16"href="javascript:" onclick="javascript:postDigg(\'good\','.$id.')"><span  =id="digg'.$id.'"class="icon-heart-on">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;</a>'.$row['goodpost'];   //點(diǎn)擊后,如果從沒(méi)有被贊過(guò),則自動(dòng)把新的點(diǎn)擊次數(shù)重寫(xiě)入目標(biāo)位置.
}   
AjaxHead();   
echo $digg;   
exit();   
?>  

版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!

轉(zhuǎn)載請(qǐng)注明: 織夢(mèng)列表頁(yè),支持頂(贊)和踩的功能,頂過(guò)后標(biāo)紅高亮顯示

標(biāo)簽:  
相關(guān)文章
模板推薦