码迷,mamicode.com
首页 > 其他好文 > 详细

根据会员权限显示指定字段教程与源码

时间:2014-07-22 22:54:13      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   os   文件   

使用说明:

一、创建目录

在帝国的插件目录:e/extend/创建yz目录

二、创建文件

在我们创建的目录内新建一个文件index.php,文件内容如下

<?php
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../data/dbcache/class.php");
$link=db_connect();
$empire=new mysqlquery();
$classid=(int)$_GET[‘classid‘];
$id=(int)$_GET[‘id‘];
$muserid=(int)getcvar(‘mluserid‘);//用户id
$musername=RepPostVar(getcvar(‘mlusername‘));//用户名
$mgroupid=(int)getcvar(‘mlgroupid‘);//会员组id
if($classid && $id && $class_r[$classid][tbname])
{
$r=$empire->fetch1("select id,title,tprice,price from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id=‘$id‘ and classid=‘$classid‘ limit 1");
if($r[id] && !$mgroupid==1)
{
?>
document.write(‘市场价:<?=$r[tprice]?>‘);
<?php
}
if($r[id] && $mgroupid==1)
{
?>
document.write(‘会员价:<?=$r[price]?>‘);
<?php
}
}
db_close();
$empire=null;
?>

三、模板中使用

在商城模板中找到价格显示的位置

用以下代码替换

<span class="price">
<script src="[!--news.url--]e/extend/yz/?id=[!--id--]&classid=[!--classid--]"></script>
</span>

根据会员权限显示指定字段教程与源码,布布扣,bubuko.com

根据会员权限显示指定字段教程与源码

标签:style   blog   color   使用   os   文件   

原文地址:http://www.cnblogs.com/wordgao/p/3849224.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!