最近用帝国系统做人才展示模板,想将联系方式隐藏起来,只给限定的人查看:
实现方法一:
1、内容也需要为PHP动态模式
修改栏目,把内容页扩展名改为.php
2、在内容页模板里加php验证代码
模板加这个代码
<!--code.start-->?
if(!$_COOKIE[ecmsmlgroupid])
{
echo "您不是会员";
}
elseif($_COOKIE[ecmsmlgroupid]==1)
{
echo"普通会员";
}
elseif($_COOKIE[ecmsmlgroupid]==2)
{
echo"VIP会员";
}
?<!--code.end-->
ecms为cookie前缀,可以看e/class/config.php ;中文则是要显示的。
实现方法二
前台页面可以为静态html模式,但稍麻烦点,需要增加个页面
1、把show.php放到e目录里,内容为如下:
<?php
require("class/connect.php");
include("class/db_sql.php");
include("class/config.php");
include("class/class.php");
$link=db_connect();
$empire=new mysqlquery();
$classid=intval($_GET['classid']);
$id=intval($_GET['id']);
$muserid=(int)getcvar('mluserid');//用户id
$musername=RepPostVar(getcvar('mlusername'));//用户名
$mgroupid=(int)getcvar('mlgroupid');//会员组id
if($classid&&$id&&$class_r[$classid][tbname]&&$muserid)
{
$r=$empire->fetch1("select id,title from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' and classid='$classid' limit 1");
if($r[id])
{
?>
document.write('标题:<?=$r[title]?>');
<?php
}
}
else
{
?>
document.write('登录后才能查看');
<?php
}
db_close();
$empire=null;
?>
内容模板显示调用
<script src="//m.kunlunjiyan.com/home/[!--news.url--]e/show.php?classid=[!--classid--]&id=[!--id--]"></script>
上面的sql语句只是查询title,其他字段自行修改