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

首頁 > 網站 > 建站經驗 > 正文

ECShop首頁調用最新評論+(增加顯示評論時間)

2024-04-25 20:42:29
字體:
來源:轉載
供稿:網友

今天給大家介紹一篇文章,是關于ECShop首頁調用最新評論+(增加顯示評論時間),分享給大家供大家參考。具體如下:

在庫目錄里增加一個文件:index_comments.lbi 里面有內容如下:

<?php

if(!function_exists("get_comments")){

function get_comments($num)

{

$sql = 'SELECT * FROM '. $GLOBALS['ecs']->table('comment') .

' WHERE status = 1 AND parent_id = 0 and comment_type=0 '.

' ORDER BY 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'] = $comments[$idx]['add_time'] = local_date

($GLOBALS['_CFG']['time_format'], $row['add_time']);

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

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

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

}

return $comments;

}

}

?>

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

<!--數據調用-最新評論開始 -->

<?php

$this->assign('my_comments',get_comments(10)); // 10條數據

?>

<div class="comments">

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

<div class="t_l f_l"><a href="goods.php?id={$comments.id_value}" target="_blank">

{$comments.content|truncate:15:""}</a></div><div class="d_r f_r">時間:

{$comments.add_time}</div>

<!--{/foreach}-->

</div>

首頁調用這個庫文件就OK了.

<!-- #BeginLibraryItem "/library/index_comments.lbi" --> <!-- #EndLibraryItem -->

以上就是本文章的內容,希望對大家有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 灵山县| 瓮安县| 涟水县| 二连浩特市| 仲巴县| 河西区| 壤塘县| 北宁市| 洛浦县| 彭山县| 东明县| 通化市| 长汀县| 肃南| 平远县| 都昌县| 河津市| 临高县| 塔河县| 云浮市| 沅陵县| 桃园县| 兴化市| 盈江县| 时尚| 山东省| 潮安县| 新郑市| 抚顺市| 富川| 楚雄市| 台山市| 巴彦县| 无为县| 阿拉善右旗| 潮州市| 景东| 乾安县| 北宁市| 甘洛县| 宜都市|