帝國之所以強大就在于他可以隨心所欲的處理信息,這里我來講一下如何在列表中顯示某會員組會員發的信息,當然也可以顯示指定會員發的信息。
一、準備
首先在userfun.php中加入函數
//getmembergroupfunction getmember($gid){global $empire,$navinfor,$public_r,$dbtbpre;$sql=$empire->query("select userid,groupid from {$dbtbpre}enewsmember where groupid='$gid'");$members="";$i=0;while($r=$empire->fetch($sql)){ $i++; if($i>1) { $members.=','.$r['userid']; } else { $members.=$r['userid']; }}return $members;}
這個函數用于獲取某一會員組中的會員。
二、應用在進入列表頁的模板中定義列表連接:先加入代碼獲取會員ID
<?php//參數配置$gid= getmember(5); //會員組ID 這里的是5?>
定義進入列表的鏈接
<a href="[!---news.url--]e/action/ListInfo.php?classid=1&ph=1&m=<?=$gid?>">VIP會員文章</a>
其中的m=就是將會員ID加入到列表頁中。列表文件修改 e/action/Listinfo.php 我們找到代碼
if($_GET['isgood']){ $isgood=(int)$_GET['isgood']; if($isgood==10) { $add.=" and isgood>0"; } else { $add.=" and isgood='".$isgood."'"; } $search.='&isgood='.$isgood;}
這段代碼的意思是顯示推薦信息,以此為例我們在它下面加入代碼,以顯示指定會員的投稿
//按會員輸出if($_GET['m']){ $member=$_GET['m']; $add.=" and userid in ('".$member."')"; $search.='&m='.$m;}
現在我們打開剛才定義的連接,我這里是
http://localhost/e/action/ListInfo.php?classid=1&ph=1&m=3&tempid=11
看吧,現在結果中只顯示會員ID為3的投稿了。
新聞熱點
疑難解答