帝國CMS內容頁調用當前文章作者信息及調用會員除了當前文章以外的其他相關文章
發布時間:2019-10-14 來源:未知 瀏覽: 關鍵詞:
內容頁調用當前文章作者信息及調用會員除了當前文章以外的其他相關文章
一、調用會員信息:
把以下代碼加到內容頁模板里即可
<?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] 即:調用當前發布者在其他欄目發布的信息
“暫時沒有其他文章”可以刪除
注意:以上(調用用戶發過的其他文章信息)除了不能調用后臺“站長”發布的文章外,能調出“會員”和“游客”的文章
一、調用會員信息:
把以下代碼加到內容頁模板里即可
<?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] 即:調用當前發布者在其他欄目發布的信息
“暫時沒有其他文章”可以刪除
注意:以上(調用用戶發過的其他文章信息)除了不能調用后臺“站長”發布的文章外,能調出“會員”和“游客”的文章
責任編輯:實速科技