帝国CMS实现内容页调用当前会员信息及文章信息的方法
采用帝国CMS制作会员系统的时候经常会需要在各个页面灵活的调用会员信息及对应栏目列表信息,本文讲述了帝国CMS实现内容页调用当前会员信息及文章信息的方法,具体步骤如下:
一、调用会员信息:
把以下代码加到内容页模板里即可
代码如下:
<?php
$userr=sys_ShowMemberInfo(0,'');
?>
<span>注册时间:<?=$userr[registertime]==null?"":date('m-d',$userr[registertime])?></span>
<span>会员积分:<?=$userr[userfen]?>分</span>
<span>上传小说:<?=$empire->gettotal("select count(*) as total from phome_ecms_download where userid='$navinfor[userid]' and ismember=1")?>本</span>
<span><?=$userr[groupname]?></span>
$userr=sys_ShowMemberInfo(0,'');
?>
<span>注册时间:<?=$userr[registertime]==null?"":date('m-d',$userr[registertime])?></span>
<span>会员积分:<?=$userr[userfen]?>分</span>
<span>上传小说:<?=$empire->gettotal("select count(*) as total from phome_ecms_download where userid='$navinfor[userid]' and ismember=1")?>本</span>
<span><?=$userr[groupname]?></span>
二、调用文章列表信息(会员投稿文章):
调用当前会员投稿的文章(5条):
代码如下:
<?php
$sql=$empire->query("select * from phome_ecms_download where userid='$navinfor[userid]' and ismember=1 order by newstime asc limit 5");
while($r=$empire->fetch($sql))
{
$titleurl=sys_ReturnBqTitleLink($r);//链接
?>
<li><a href="<?=$titleurl?>" target="_blank" title="<?=$r[title]?>" ><?=esub($r[title],40)?></a></li>
<?php
}
?>
$sql=$empire->query("select * from phome_ecms_download where userid='$navinfor[userid]' and ismember=1 order by newstime asc limit 5");
while($r=$empire->fetch($sql))
{
$titleurl=sys_ReturnBqTitleLink($r);//链接
?>
<li><a href="<?=$titleurl?>" target="_blank" title="<?=$r[title]?>" ><?=esub($r[title],40)?></a></li>
<?php
}
?>
本文由主机测评网发布,不代表主机测评网立场,转载联系作者并注明出处:https://zhuji.jb51.net/diguocms/6926.html