分类分类
更新时间:2026-03-29 02:50:52作者:fang
ECSHOP首页调用最新评论插件,提供如下修改代码:
<?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">
<!--数据调用-最新评论开始 -->
<?php
$this->assign('my_comments',get_comments(5)); // 数据条数
?>
<!--{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)); // 数据条数 这里的5 是你要调用的数量。。。
?>
相关
王道三国策略游戏380.18 MBv0.0.12026-03-28
下载刮个爽手机版休闲益智186.96 MBv1.0.282026-03-28
下载龙符天祭策略游戏756.03 Mv22026-03-28
下载入魂一番赏app网上购物106.66 Mv4.3.52026-03-28
下载童话师经营养成504.02 Mv1.1.52026-03-28
下载Bebo Cam app图像拍照264.51 Mv2.3.02026-03-28
下载纯三国官方正版策略游戏167.24 Mv0.0.12026-03-28
下载Poka Cam app图像拍照74.7 Mv1.8.02026-03-28
下载COLMO app趣味娱乐199.15 Mv2.3.5.22026-03-28
下载愤怒的小鸟变形金刚苹果版休闲游戏439.4 Mv2.39.02026-03-28
下载这也能切苹果版休闲游戏479.6 Mv21342026-03-28
下载口袋吉伊卡哇苹果手机版模拟游戏920.4 Mv2.0.02026-03-28
下载










