QQ在線咨詢在線咨詢 幫做網絡積累了豐富的項目經驗,聚集了一批資深專業人才,售后服務一流,內業好評不斷,是一家專業的網站建設服務商。微信:skin2288 專業的網站建設服務商。微信:skin2288 網站建設地圖?|?城市分站

織夢文章頁/列表頁調用評論數、收藏數、好評、差評的sql語句

發布時間:2020-02-03 21:59:50??作者:專業網站建設工程師?來源:幫做網絡 瀏覽量:

導??讀:dedecms列表頁調用評論數 a href = [field:cfg_basehost/]/plus/feedback.php?aid=[field:id/] [field:id runphp=yes] $aid = @me; $row = $GLOBALS[dsql]-GetOne(Select coun...

dedecms列表頁調用評論數

 

<a href="[field:cfg_basehost/]/plus/feedback.php?aid=[field:id/]">
        [field:id runphp='yes'] $aid = @me; $row = $GLOBALS['dsql']->GetOne("Select count(id) as c from dede_feedback where aid=".@me); @me=$row['c'];[/field:id]條評論
</a>

dedecms列表頁調用收藏數

 

<a href="[field:cfg_basehost/]/plus/feedback.php?aid=[field:id/]">
        [field:id runphp='yes'] $aid = @me; $row = $GLOBALS['dsql']->GetOne("Select count(id) as c from dede_member_stow where aid=".@me); @me=$row['c'];[/field:id]條評論
</a>

dedecms文章頁調用評論數

 

<a href="{dede:field.cfg_basehost/}/plus/feedback.php?aid={dede:field.id/}">
    {dede:field.id runphp='yes'}
         $aid = @me; $row = $GLOBALS['dsql']->GetOne("Select count(id) as c from dede_feedback where aid=".@me); @me=$row['c'];
    {/dede:field.id}條評論
</a>
dedecms列表頁好評與差評調用

 

<div class='good' title='好評' id="[field:id/]"> <span id='good[field:id/]'>好評:[field:goodpost/]</span> </div>
<div class='bad' title='差評' id="[field:id/]"> <span id='bad[field:id/]'>差評:[field:badpost/]</span> </div>
dedecms文章頁好評調用

 

<div class='good' title='好評' id="{dede:field.id/}"> <span id='good{dede:field.id/}'>好評:{dede:field.goodpost/}</span> </div>
<div class='bad' title='差評' id="{dede:field.id/}"> <span id='bad{dede:field.id/}'>差評:{dede:field.badpost/}</span> </div>
如果想點擊好評、差評起作用,加上下面的JS即可

 

<script type="text/javascript" src="{dede:global.cfg_basehost/}/member/templets/js/j.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $("div[class*='good'],div[class*='bad']").bind("click", function(){
        var type = $(this).attr('class'),aid = $(this).attr('id');
        var saveId = getCookie('diggid');
        if(saveId != null)
        {
            var saveIds = saveId.split(',');
            var hasId = false;
            j = 1;saveId = '';
            for(i=saveIds.length-1;i>=0;i--)
            {
                if(saveIds[i]==aid && hasId) continue;
                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("您已經頂過該帖,請不要重復頂帖 !"); return false; }
            else saveId += ','+aid;
            setCookie('diggid',saveId,1);
        }
        else
        {
            setCookie('diggid',aid,1);
        }        
        $.ajax({type: 'POST',url: "{dede:global.cfg_basehost/}/plus/feedback.php",
            data: "formurl=caicai&action="+type+"&aid="+aid,
            dataType: 'text',
            success: function(result){$("#"+type+aid).html(result);}
        });
        
    });
});
//讀寫cookie函數
function getCookie(c_name)
{
    if (document.cookie.length > 0)
    {
        c_start = document.cookie.indexOf(c_name + "=")
        if (c_start != -1)
        {
            c_start = c_start + c_name.length + 1;
            c_end   = document.cookie.indexOf(";",c_start);
            if (c_end == -1)
            {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start,c_end));
        }
    }
    return null
}
function setCookie(c_name,value,expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" +escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); //使設置的有效時間正確。增加toGMTString()
}
function postBadGood(type,id){}
</script>

轉載請注明出處: 首頁 > 知識學堂 > dedecms仿站 > >織夢文章頁/列表頁調用評論數、收藏數、好評、差評的sql語句


易中彩票