帝国CMS会员中心模板改造之用户自己查看评论过的文章
2018-10-16 站长 站长日志
会员中心改造的时候需要用到调用用户评论过的文章列表功能,也就是说会员自己评论过的文章所形成的列表!代码如下:
<div style="border:1px solid #ddd; ">
<div class="header" style="border-bottom:1px solid #ddd">我的评论</div>
<ul style=" ">
<?php
$sql=$empire->query("select A.id,A.saytime,B.title,B.titleurl from {$dbtbpre}enewspl_1 as A, {$dbtbpre}ecms_news as B where A.id=B.id && A.userid=$user[userid] order by A.saytime desc limit 100"); //查询评论
while($r=$empire->fetch($sql)) //循环获取查询记录
{
echo "<li style='height:26px;line-height:26px;text-indent:10px;border-top:1px solid #eee;'><a target=_blank href=".$r['titleurl'].">".$r['title']."(".date('Y-m-d',$r[saytime]).")</a></li>";
}
?>
<ul>
</div>
注意:{$dbtbpre}ecms_news 数据表名
<div style="border:1px solid #ddd; ">
<div class="header" style="border-bottom:1px solid #ddd">我的评论</div>
<ul style=" ">
<?php
$sql=$empire->query("select A.id,A.saytime,B.title,B.titleurl from {$dbtbpre}enewspl_1 as A, {$dbtbpre}ecms_news as B where A.id=B.id && A.userid=$user[userid] order by A.saytime desc limit 100"); //查询评论
while($r=$empire->fetch($sql)) //循环获取查询记录
{
echo "<li style='height:26px;line-height:26px;text-indent:10px;border-top:1px solid #eee;'><a target=_blank href=".$r['titleurl'].">".$r['title']."(".date('Y-m-d',$r[saytime]).")</a></li>";
}
?>
<ul>
</div>
注意:{$dbtbpre}ecms_news 数据表名