小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

ecshop首頁(yè)調(diào)用評(píng)論函數(shù)(index.php)

 quasiceo 2014-05-03

ecshop首頁(yè)調(diào)用評(píng)論函數(shù)(index.php)

(2012-02-21 14:57:07)
標(biāo)簽:

取得

調(diào)用

函數(shù)

記錄

雜談

分類: ecshop

1.
function comments_info($count=1)
{
    $sql = "SELECT g.goods_id,g.goods_name,g.goods_thumb,tb.ct FROM ".
 $GLOBALS['ecs']->table('goods'). " g join".
 "(select  id_value id,count(*) ct from ".
 $GLOBALS['ecs']->table('comment')."  where comment_type=0 and status=1  group by id_value) tb ".
 "on g.goods_id=tb.id ";
 if(!empty($count)) $sql.=" limit 0,".$count; 
    $res = $GLOBALS['db']->getAll($sql);
 $arr = array();
    foreach ($res AS $i => $row)   
    
       $arr[$i]['goods_id']=$row['goods_id'];
    $arr[$i]['goods_name']=$row['goods_name'];
    $arr[$i]['count']=$row['ct'];
    $arr[$i]['goods_thumb']=$row['goods_thumb']; 
    $arr[$i]['comment']= get_comment($row['goods_id']);
    }
    return $arr;
}

function get_comment($goodid=0)
{
 $sql = "SELECT * FROM ". $GLOBALS['ecs']->table('comment')." WHERE `id_value`=".
 $goodid." and status=1  order by `parent_id`,`add_time` LIMIT 0,4";
    return $GLOBALS['db']->getAll($sql);
}

 

2.

$smarty->assign('comment_list',    comments_info(10));        // 商品評(píng)論 

 

3.

<!--商品評(píng)論開(kāi)始{if $comment_list}-->

 <div style="overflow:hidden;height:190px;" id="demo">
 <div id="demo1">
     <ul>
 <!--{foreach from=$comment_list item=comm}-->
    <li>  
        <div class="fl"><a href="goods.php?id={$comm.goods_id}" title="{$comm.goods_name}" target="_blank">
        <img  alt="{$comm.goods_name}" src="{$comm.goods_thumb}" style="width:80px;"></a>
        </div>
        <div class="fl " style="padding-top:5px;width:350px;">
           
        <!--{foreach from=$comm.comment item=info}-->
          <!--{if $info.user_name}-->
         <font class="bl" >{$info.user_name}</font>:<a href="goods.php?show=a&id={$comm.goods_id}"  target="_blank"> {$info.content}</a> <br/>  
         <!--{/if}-->    
        <!--{/foreach}-->
        </div>
    </li>  
    <!--{/foreach}-->
    </ul> 
    </div>
    <div id="demo2"></div> 
    </div>


<!--商品評(píng)論結(jié)束{/if}-->

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多