第877天:uch2.0群主与副群主分开调用,uch2.0群组首页会员随机显示

星期四 小雨,傍晚转阴(昨夜中到小雨) 13~18℃

uch2.0 群主与副群主分开调用

source/space_mtag.php

原始:

$list = $starlist = $modlist = $memberlist = $checklist = array();
(此间代码略)
//群主
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname(‘tagspace’)." WHERE tagid=’$tagid’ AND grade>’7′ ORDER BY grade DESC LIMIT 0,12");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
 realname_set($value['uid'], $value['username']);
 $modlist[] = $value;
}

修改(增加 $modlist2 和 $modlist3,对应 grade 值):

$list = $starlist = $modlist = $modlist2 = $modlist3 = $memberlist = $checklist = array();
(此间代码略)
//群主与副群主(此处与原始代码一样)
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname(‘tagspace’)." WHERE tagid=’$tagid’ AND grade>’7′ ORDER BY grade DESC LIMIT 0,12");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
 realname_set($value['uid'], $value['username']);
 $modlist[] = $value;
}
//群主
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname(‘tagspace’)." WHERE tagid=’$tagid’ AND grade=’9′ ORDER BY grade DESC LIMIT 0,12");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
 realname_set($value['uid'], $value['username']);
 $modlist2[] = $value;
}
//副群主
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname(‘tagspace’)." WHERE tagid=’$tagid’ AND grade=’8′ ORDER BY grade DESC LIMIT 0,12");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
 realname_set($value['uid'], $value['username']);
 $modlist3[] = $value;
}

模板调用:

space_mtag_index.htm

原始:

<!–{if $modlist}–>
<div class="sidebox">
 <h2 class="title">
  <span class="r_option"><a href="space.php?do=mtag&tagid=$mtag[tagid]&view=member">全部</a></span>
  群主
 </h2>
 <ul class="avatar_list">
 <!–{loop $modlist $value}–>
  <li>
   <div class="avatar48"><a href="space.php?uid=$value[uid]"><!–{avatar($value[uid],small)}–></a></div>
   <p><a href="space.php?uid=$value[uid]">{$_SN[$value[uid]]}</a></p>
  </li>
 <!–{/loop}–>
 </ul>
</div>
<!–{/if}–>

修改(使用 $modlist2 和 $modlist3 分开调用):

<!–{if $modlist}–>
<div class="sideOne">
 <h2 class="s_tiBg bgSide">创建者<em>/</em>管理员</h2>
 <div class="s_con">
  <ul class="headLiSide">
   <!–{loop $modlist2 $value}–>
   <li>
    <p><a href="space.php?uid=$value[uid]"><!–{avatar($value[uid],small)}–></a></p>
    <p class="myname"><a href="space.php?uid=$value[uid]"><strong>{$_SN[$value[uid]]}</strong></a></p>
   </li>
   <!–{/loop}–>
   <!–{loop $modlist3 $value}–>
   <li>
    <p><a href="space.php?uid=$value[uid]"><!–{avatar($value[uid],small)}–></a></p>
    <p class="myname"><a href="space.php?uid=$value[uid]">{$_SN[$value[uid]]}</a></p>
   </li>
   <!–{/loop}–>
  </ul>
 </div>
 <div class="s_botBg bgSide "></div>
</div>
<!–{/if}–>


uch2.0 群组首页会员随机显示

source/space_mtag.php

原始:

//会员
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname(‘tagspace’)." WHERE tagid=’$tagid’ AND grade=’0′ LIMIT 0,12");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
 realname_set($value['uid'], $value['username']);
 $memberlist[] = $value;
}

修改

//会员
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname(‘tagspace’)." WHERE tagid=’$tagid’ AND grade=’0′");//删除这里的“LIMIT 0,12”
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
 realname_set($value['uid'], $value['username']);
 $memberlist[] = $value;
}
$memberlist = sarray_rand($memberlist, 12);//随机选择,把上面的 12 移到这里


友吧今天

1、把不需要的模板移到“排除的”目录下,扩展起来比较方便,130 来个模板,排除了大约一半。

2、圈子首页嵌套完成。

RSS

上一篇:

下一篇:

发表评论

电子邮件地址不会被公开。 必填项已用*标注