国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

ECSHOP首頁調(diào)用最新評論插件

2024-04-25 20:41:33
字體:
供稿:網(wǎng)友

ECSHOP首頁調(diào)用最新評論插件,提供如下修改代碼:

<?php

if(!function_exists("get_comments")){

function get_comments($num)

{

$sql = 'SELECT a.*,b.goods_id,b.goods_thumb,b.goods_name FROM '. $GLOBALS['ecs']->table('comment') .

' AS a,'. $GLOBALS['ecs']->table('goods') .'AS b WHERE a.status = 1 AND a.parent_id = 0 and a.comment_type=0 and

a.id_value=b.goods_id '.

' ORDER BY a.add_time DESC';

if ($num > 0)

{

$sql .= ' LIMIT ' . $num;

}

//echo $sql;

$res = $GLOBALS['db']->getAll($sql);

$comments = array();

foreach ($res AS $idx => $row)

{

$comments[$idx]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']);

$comments[$idx]['content'] = $row['content'];

$comments[$idx]['id_value'] = $row['id_value'];

$comments[$idx]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);

$comments[$idx]['goods_name'] = $row['goods_name'];

}

return $comments;

}

}

?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<!--數(shù)據(jù)調(diào)用-最新評論開始 -->

<?php

$this->assign('my_comments',get_comments(5)); // 數(shù)據(jù)條數(shù)

?>

<!--{foreach from=$my_comments item=comments}-->

<table width="290" border="0" cellspacing="0" cellpadding="0" style=" border-bottom:1px #ccc dashed;">

<tr>

<td width="73" height="70" align="center"><a href="goods.php?id={$comments.id_value}" target="_blank"><img

src="{$comments.goods_thumb}" border="0" width="60" height="60" style=" border:1px #CCCCCC solid;"/></a></td>

<td width="473" align="left" valign="top">

<div style="height:3px; overflow:hidden;"> </div>

<div><a href="goods.php?id={$comments.id_value}" target="_blank"><font style=" color:#FF0000; font-size:14px;">

{$comments.goods_name}</font></a></div>

<div><img src="../images/pl.gif" width="38" height="19" align="absmiddle">{$comments.content|truncate:100:""}</div>

<div style="color:#999999;">時間:{$comments.add_time}</div>

</td>

</tr>

</table>

<!--{/foreach}-->

此處:

<?php

$this->assign('my_comments',get_comments(5)); // 數(shù)據(jù)條數(shù) 這里的5 是你要調(diào)用的數(shù)量。。。

?>

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 综艺| 睢宁县| 德保县| 天峻县| 屏南县| 衡水市| 巴塘县| 金坛市| 呼图壁县| 仁布县| 澎湖县| 辛集市| 鄂托克前旗| 略阳县| 工布江达县| 汉源县| 北辰区| 淮北市| 建始县| 格尔木市| 都安| 泸定县| 铁岭县| 司法| 翁源县| 积石山| 岗巴县| 竹北市| 扬州市| 湘潭县| 昌黎县| 库车县| 铁岭县| 塔河县| 遂平县| 湖南省| 乌兰察布市| 朝阳市| 卓资县| 当雄县| 日喀则市|