帝国CMS内容页调用当前文章作者信息及调用会员除了当前文章以外的其他相关文章

发布时间:2021-02-10作者:帝国建站网
内容页调用当前文章作者信息及调用会员除了当前文章以外的其他相关文章


一、调用会员信息:
把以下代码加到内容页模板里即可

<?php 
$userr=sys_ShowMemberInfo(0,''); 
?>
<span>会员头像:<img src="<?=$userr[userpic]?$userr[userpic]:$public_r[newsurl].'e/data/images/doimg.gif'?>"></span> <br>
<span>会员:<?=$userr[username]?></span> <br>
<span>会员ID:<?=$userr[userid]?></span> <br>
<span>注册时间:<?=$userr[registertime]==null?"":date('y-m-d',$userr[registertime])?></span> <br>
<span>会员积分:<?=$userr[userfen]?>分</span> <br>
<span>发布新闻:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_news where userid='$navinfor[userid]' and ismember=1")?>条</span> <br>
<span>会员组:<?=$userr[groupname]?></span><br>
<span>作者文章列表:<a href="<?=$public_r[newsurl]?>e/space/list.php?userid=<?=$userr[userid]?>&mid=1">文章列表</a></span><br>

二、调用用户发过的其他文章信息(会员投稿文章):


1、php调用
调用当前会员投稿的文章(5条):
---------------------
<?php 
$sql=$empire->query("select * from {$dbtbpre}ecms_news where userid='$navinfor[userid]' and classid='$navinfor[classid]' and id<>$navinfor[id] and ismember=1 order by newstime asc limit 5"); 
while($r=$empire->fetch($sql)) 
if($navinfor[ismember]==1)

$titleurl=sys_ReturnBqTitleLink($r);//链接 
?> 

<li><a href="<?=$titleurl?>" target="_blank" title="<?=$r[title]?>" ><?=esub($r[title],40)?></a></li> 
<?php
}
else
{
?>
暂时没有其他文章
<?php 

?>





2、灵动标签调用
----------------------
[e:loop={"select * from [!db.pre!]ecms_news where userid='$navinfor[userid]' and classid='$navinfor[classid]' and id<>$navinfor[id] and ismember=1 order by newstime desc limit 10",0,24,0}]
<?php
if($navinfor[ismember]==1)
{
?>

<li><a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>"><?=esub($bqr[title],50)?></a></li>
<?php
}
else
{
?>
暂时没有其他文章
<?php
}
?>
[/e:loop]



[e:loop={'selfinfo',10,0,0,"userid='$navinfor[userid]' and classid='$navinfor[classid]' and id<>$navinfor[id] and ismember=1"}]
 <?php
if($navinfor[ismember]==1)
{
?>

<li><a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>"><?=esub($bqr[title],50)?></a></li>
<?php
}
else
{
?>
暂时没有其他文章
<?php
}
?>
[/e:loop]  



==============================================调用用户发过的其他文章信息注释========================================================
注释:id<>$navinfor[id]或and id!=$navinfor[id] 意思为:不等于当前文章id

  ①、classid='$navinfor[classid]'  意思为:只调用当前栏目的文章(如果删除它后,会调用会员在整个模型中其他栏目发过的文章)

  ②、classid也可以指定显示栏目的id 格式如:classid=34 或  classid in (2,3))

  ③、classid还可以排除当前栏目  格式如:classid<>$navinfor[classid]  即:调用当前发布者在其他栏目发布的信息

     “暂时没有其他文章”可以删除

注意:以上(调用用户发过的其他文章信息)除了不能调用后台“站长”发布的文章外,能调出“会员”和“游客”的文章

上一篇:帝国CMS首页调用已注册会员人数和最新会员名称

下一篇:帝国CMS首页调用会员信息(两表多表查询)