论坛风格切换
  • 3421阅读
  • 0回复

[定制开发功能]个人中心帖子增加精华帖筛选类型 [复制链接]

上一主题 下一主题
离线rickyleo
 

发帖
315
金币
0
威望
99
只看楼主 倒序阅读 使用道具 楼主  发表于: 2011-08-10
显示效果如下:

修改如下:
打开apps/article/index.php文件,找到:
  1. } elseif ($a == 'friend') {
  2.     $thisbase = $basename.'a=friend&';
  3.     if ($friends = getFriends($winduid)) {
  4.         $uids = array_keys($friends);
  5.         !empty($fids) && $where .= "fid NOT IN($fids) AND ";
  6.         $where .= "authorid IN(".S::sqlImplode($uids).") AND ifcheck=1 AND ifhide=0 AND anonymous=0";
  7.         $where .= " AND postdate>".S::sqlEscape($timglimit);
  8.     } else {
  9.         //require_once(M_P.'require/header.php');
  10.         //require_once PrintEot('m_article');
  11.         //footer();
  12.         list($isheader,$isfooter,$tplname,$isleft) = array(true,true,"m_article",true);
  13.     }
  14.     $username = $windid;
  15. }
上上上方添加如下代码:
  1. elseif ($see == 'digest') {
  2.         !in_array($ordertype,array('lastpost','postdate')) && $ordertype = 'postdate';
  3.         S::gp(array('posttime'));
  4.         if ($u!=$winduid) {
  5.             $where .= 'authorid='.S::sqlEscape($u).' AND anonymous=0 AND ifhide=0 AND fid<>0 AND digest<>0';
  6.             $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */
  7.             $username = $userService->getUserNameByUserId($u);
  8.             $thisbase = $basename.'ordertype='.$ordertype.'&';
  9.         } else {
  10.             $where .= 'authorid='.S::sqlEscape($winduid).' AND digest<>0';
  11.             $thisbase = $basename.'ordertype='.$ordertype.'&posttime='.$posttime.'&';
  12.             $username = $windid;
  13.             $u = $winduid;
  14.         }
  15.         if (is_numeric($posttime) && $posttime) {
  16.             if ($posttime != '366') {
  17.                 $where .= " AND postdate>=".S::sqlEscape($timestamp - $posttime*84600);
  18.             } elseif ($posttime == '366') {
  19.                 $where .= " AND postdate<=".S::sqlEscape($timestamp - 365*84600);
  20.             }
  21.         }
  22.     }
模版修改请打开apps/article/template/m_space_article.htm文件,找到相应位置:
  1. } elseif ($see == 'post') { ………………}
这个判断语句的结束加上如下代码:
  1. elseif($see == 'digest') {print <<<EOT
  2. -->
  3.                 <div class="cc filter">
  4.                         <h3>类型筛选:</h3>
  5.                         <ul class="mr20"><li id="a_topic"><a href="{$basename}">主题</a></li><li id="a_post"><a href="{$basename}see=post">回复</a></li><li id="a_digest" class="current"><a href="{$basename}see=digest">精华</a></li><li id="a_goods"><a href="{$basename}a=goods&job=onsale">商品</a></li></ul>
  6.                         <h3>选择时间:</h3>
  7.                         <ul><li id="post_0"><a href="{$basename}see=digest&posttime=0">所有</a></li><li id="post_1"><a href="{$basename}see=digest&posttime=1">一天</a></li><li id="post_2"><a href="{$basename}see=digest&posttime=2">两天</a></li><li id="post_7"><a href="{$basename}see=digest&posttime=7">一星期</a></li><li id="post_30"><a href="{$basename}see=digest&posttime=30">一个月</a></li><li id="post_60"><a href="{$basename}see=digest&posttime=60">两个月</a></li><li id="post_90"><a href="{$basename}see=digest&posttime=90">三个月</a></li><li id="post_180"><a href="{$basename}see=digest&posttime=180">半年</a></li><li id="post_365"><a href="{$basename}see=digest&posttime=365">一年</a></li><li id="post_366"><a href="{$basename}see=digest&posttime=366">一年以上</a></li></ul>
  8.                 </div>
  9. <script language="javascript">setCurrent('post_$posttime','post_0','current');</script>
  10.                 <div style="border-top:1px solid $uskin_bdA;">
  11.                     <table width="100%" style="table-layout:fixed;">  
  12.                         <tr class="tr3">
  13.                             <td colspan="2">排序方式:<a href="{$basename}see=digest&ordertype=postdate" id="a_orderpostdate"><span>发帖时间</span></a>    <a href="{$basename}see=digest&ordertype=lastpost" id="a_orderlastpost"><span>回复时间</span></a>
  14.                                 <script language="JavaScript">setCurrent('a_order{$ordertype}','a_orderpostdate','link_down s5');</script>
  15.                             </td>
  16.                             <td width="80">回复/人气</td>
  17.                             <td width="100">最后发表</td>
  18.                         </tr>
  19.                     </table>
  20.                     <table width="100%" class="mb10" style="table-layout:fixed;">  
  21. <!--
  22. EOT;
  23. if (!empty($article)) {
  24. foreach ($article as $key => $value) {print <<<EOT
  25. -->
  26.                         <tr class="tr3">
  27.                             <td width="20" class="tac"><img src="images/wind/thread/topicnew.gif" /></td>
  28.                             <td class="f14">
  29.                                 <a href="thread.php?fid=$value[fid]" class="mr5" target="_blank">[{$value[forum]}]</a><a href="read.php?tid=$value[tid]" target="_blank" class="s5">$value[subject]</a>
  30.                             </td>
  31.                             <td width="80" class="f10">
  32.                                 <span class="s2">{$value[replies]}</span>/<span>{$value[hits]}</span>
  33.                                 <p>{$value[postdate]}</p>
  34.                             </td>
  35.                             <td width="100">
  36.                                 <a href="u.php?username=$value[lastposter]" class="s6">$value[lastposter]</a>
  37.                                 <p class="f10">{$value[lastpost]}</p>
  38.                             </td>
  39.                         </tr>
  40. <!--
  41. EOT;
  42. }} else {print <<<EOT
  43. -->
  44.                         <tr>
  45.                                 <td class="tac f14 p10" colspan="5">暂无主题!</td>
  46.                         </tr>
  47. <!--
  48. EOT;
  49. }print <<<EOT
  50. -->
  51.                     </table>
  52.                     <div class="mt10">$pages</div>
  53.                 </div>
  54. <!--
  55. EOT;
  56. }
其他导航的地方,同样加上精华的链接地址:
  1. <li id="a_digest"><a href="{$basename}see=digest">精华</a></li>
已提供phpwind85懒人包




附件: apps.rar (6 K) 下载次数:44
快速回复
限100 字节
如果您在写长篇帖子又不马上发表,建议存为草稿
 
提到某人:
选择好友
上一个 下一个