扫描二维码关注官方公众号
返回列表 发布新帖

[PT建站] 五步打造你个性化的Nexusphp PT站

 火...
19696 152
发表于 2010-9-27 03:56:08 | 显示全部楼层 阅读模式
本帖最后由 starx 于 2010-9-27 04:13 编辑

国内使用Nexusphp建立的PT站越来越多,风格大都雷同(正如yofeng同学所说的审美疲劳......),如何把Nexusphp快速配置成你喜欢的界面、风格,本人在这里抛砖引玉,希望大家在这里开放的讨论、共享使用Nexusphp建站心得,OK,Let's doing...

第一步:为用户等级追加标识

方法:以简体中文为例,打开nexusphp.v1.5.beta4.2010XXXX\lang\chs\lang_functions.php修改257-266行下列设置(如果要其他语种也需要,则每种语言包都要配置):
修改前:
-------------------------------------------
'text_peasant' => "Peasant",
'text_user' => "User",
'text_power_user' => "Power User",
'text_elite_user' => "Elite User",
'text_crazy_user' => "Crazy User",
'text_insane_user' => "Insane User",
'text_veteran_user' => "Veteran User",
'text_extreme_user' => "Extreme User",
'text_ultimate_user' => "Ultimate User",
'text_nexus_master' => "Nexus Master",
============================
'text_peasant' => "(堕落者)Peasant",
'text_user' => "(穷人)User",
'text_power_user' => "(百姓)Power User",
'text_elite_user' => "(小康)Elite User",
'text_crazy_user' => "(大康)Crazy User",
'text_insane_user' => "(中产)Insane User",
'text_veteran_user' => "(富商)Veteran User",
'text_extreme_user' => "(银行家)Extreme User",
'text_ultimate_user' => "(豪门)Ultimate User",
'text_nexus_master' => "(贵族)Nexus Master",
--------------------------------------------
注意:Web服务器需要重启http生效!

效果对比:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×

评论152

starx@2楼主Lv.5 发表于 2010-9-27 03:56:52 | 显示全部楼层
本帖最后由 starx 于 2010-9-27 04:38 编辑

第二步:关闭搜索箱
应用此风格的有CHDbits、TCCF、Pig2Pig等
为什么要关闭?Nexusphp的搜索箱功能十分强大,不过对用户来说并不是每次都要使用的,且所占版面较大(个人觉得也是版面看起来雷同的一大因素),由于在后台和数据库中无相关配置项,故需要对程序进行修改:

打开主目录下的torrents.php文件,查找874-876行,来到这里:
  <td class="colhead" align="center" colspan="2"><a href="javascript: klappe_news('searchboxmain')"><img class="minus" src="pic/trans.gif" id="picsearchboxmain" alt="Show/Hide" /><?php echo $lang_torrents['text_search_box'] ?></a></td>
  </tr></tbody>
  <tbody id="ksearchboxmain">

将 class="minus" 改成 class="plus"
在  <tbody id="ksearchboxmain">中追加<tbody id="ksearchboxmain" style="display:none">

完成后,代码变为:
  <td class="colhead" align="center" colspan="2"><a href="javascript: klappe_news('searchboxmain')"><img class="plus" src="pic/trans.gif" id="picsearchboxmain" alt="Show/Hide" /><?php echo $lang_torrents['text_search_box'] ?></a></td>
  </tr></tbody>
  <tbody id="ksearchboxmain" style="display:none">

效果图:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 点赞

使用道具 举报

starx@2楼主Lv.5 发表于 2010-9-27 03:57:40 | 显示全部楼层
本帖最后由 starx 于 2010-9-27 05:50 编辑

第三步: 增加种子类别快速搜索功能
应用此风格的有HDcity、高清第一等
Nexusphp种子在高亮模式下本来就有此功能,不过大多数站点缺省模式下并不流行种子高亮显示方式(本人所了解的有HDStar及部分刚运营的PT站),通过颜色来判断种子类别还是有难度的!最流行的还是以字符和图标显示(可以通过配置数据库user表来预置),但在这两种模式下恰恰没有快速搜索的字符按钮,不过我们可以通过修改代码来增加它:

打开主目录下的torrents.php文件,查找1075-1077行,来到这里
if ($count) {
print($pagertop);
if ($sectiontype == $browsecatmode)
在上面中第二行与第三行之间插入“print("<p align=\"center\"> ".$lang_functions['text_promoted_torrents_note']."</p>\n");” //这一句是完全引用作者在高亮模式下内建的语句!

修改后代码如下:
if ($count) {
print($pagertop);
    print("<p align=\"center\"> ".$lang_functions['text_promoted_torrents_note']."</p>\n");  //此处是在搜索箱下部位置插入,你也可以选择在其他位置插入!
if ($sectiontype == $browsecatmode)
  torrenttable($res, "torrents");

效果图:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 点赞

使用道具 举报

starx@2楼主Lv.5 发表于 2010-9-27 03:58:17 | 显示全部楼层
本帖最后由 starx 于 2010-9-27 05:37 编辑

第四步:改变置顶种子格子颜色
应用此风格的有CHDbits、皇后等
改变颜色有助于用户更醒目、更直观的区分置顶帖(当然方法有很多,看个人喜好,部分PT站使用“置顶”字符,CHDbits还更换了置顶标识),前些时间看到有人评价皇后的置顶种子颜色很“媚”,决定自己也改一改:
打开主目录/include/functions.php,查找3021-3023行,来到这里:

$id = $row["id"];
$sphighlight = get_torrent_bg_color($row['sp_state']);
print("<tr" . $sphighlight . ">\n");

修改程序为(用下面五行替换上面3行):
    $id = $row["id"];
    if ($row['pos_state'] == 'sticky' && $CURUSER['appendsticky'] == 'yes') {
     $sphighlight = " class='twoupfree_bg'";  
     }
     else $sphighlight = get_torrent_bg_color($row['sp_state']);
   print("<tr" . $sphighlight . ">\n");

  注意:上面$sphighlight = " class='twoupfree_bg'";  中的class='twoupfree_bg'是赋予置顶种子格子的显示颜色,属性在风格目录下的theme.css文件中定义,可以根据下面sample自行添加,然后替换上面代码中的“'twoupfree_bg'”(注意每种风格都要添加),如果嫌麻烦就直接借用种子类型的一种,本例选择了twoupfree_bg,即与2X上传颜色相同。
.free{color:#f0cc00}
.twoup{color:#aaaaaa}
.twoupfree{color:#99cc66}
.halfdown{color:#7c7ff6}
.twouphalfdown{color:#7ad6ea}
.thirtypercent{color:#70328d}
.free_bg{background-color:#ffff99}
.twoup_bg{background-color:#dddddd}
.twoupfree_bg{background-color:#ccff99}
.halfdown_bg{background-color:#cccdf8}
.twouphalfdown_bg{background-color: #96dbea}
.thirtypercentdown_bg{background-color:#ddc3ea}

注:在黑色风格下无效。

效果图:


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 点赞

使用道具 举报

starx@2楼主Lv.5 发表于 2010-9-27 03:59:10 | 显示全部楼层
本帖最后由 starx 于 2010-9-27 05:42 编辑

第五步:在种子主题上附加促销种子过期时间提示
应用此风格的有CHDbits、HDcity、皇后等

......To be continued...敬请关注!
回复 点赞

使用道具 举报

ddvccLv.7 发表于 2010-9-27 04:15:03 | 显示全部楼层
是啊 最好各个pt站都有个性些 更加美观漂亮 希望lz的教程带来帮助
认真学习下{:2_106:}
积分变更说明讨论
hd2pt.com/thread-6588-1-1.html 请不要勾引偶发帖 偶怕被扣分 thx。。  水至清则无鱼 传说逐渐淡忘。。
回复 点赞

使用道具 举报

i1999Lv.8 发表于 2010-9-27 08:15:56 | 显示全部楼层
收藏了,谢lz分享
回复 点赞

使用道具 举报

wwwyanjinLv.4 发表于 2010-9-27 09:16:55 | 显示全部楼层
不错,支持楼主
回复 点赞

使用道具 举报

ccyycccLv.8 发表于 2010-9-27 09:20:29 | 显示全部楼层
国外的站点明显比国内的个性多了.....也不知道怎么的...
工具用的都一样...{:2_136:}
回复 点赞

使用道具 举报

PiaLv.8 发表于 2010-9-27 09:34:45 | 显示全部楼层
膜拜高手,不过改过之后Nexus还是很丑
回复 点赞

使用道具 举报

bassLv.6 发表于 2010-9-27 11:26:47 | 显示全部楼层
很有用,收下了謝謝
回复 点赞

使用道具 举报

zw462149904Lv.7 发表于 2010-9-27 11:32:30 | 显示全部楼层
都是网络高手!!我就学习一下!!
回复 点赞

使用道具 举报

bigpineappleLv.4 发表于 2010-9-27 12:15:51 | 显示全部楼层
你自己重写CSS就漂亮了
回复 点赞

使用道具 举报

senlinlangziLv.10 发表于 2010-9-27 12:53:20 | 显示全部楼层
收藏!!感觉很有用,慢慢学习!!
回复 点赞

使用道具 举报

kinwai@2Lv.4 发表于 2010-9-27 12:57:56 | 显示全部楼层
技术帝呀~膜拜下。。
回复 点赞

使用道具 举报

dz127Lv.10 发表于 2010-9-27 17:05:20 | 显示全部楼层
这个不太懂啊。先收藏了
回复 点赞

使用道具 举报

starx@2楼主Lv.5 发表于 2010-9-28 06:08:06 | 显示全部楼层
原来占楼无用(180分钟后无法再编辑),继续五楼...

第五步:在种子主题上附加促销种子过期时间提示
应用此风格的有CHDbits、HDcity、皇后等

Nexusphp本来就有促销种子的过期提示(字符及图标显示模式下),只需要用鼠标放在促销类别字符或图标上就可以进行淡入淡出提示,不过用户要想了解每一个种子过期时间,都需要用鼠标进行查看,不太方便,对此可以对代码进行适当修改,使其附加到种子主/副标题上进行显示,这样看起来就直观得多了:

打开include/functions.php文件,查找3093-3095行(不同源码版本可能行号略有差异),来到这里:
print("<td class=\"rowfollow\" width=\"100%\" align=\"left\"><table class=\"torrentname\" width=\"100%\"><tr" . $sphighlight . "><td class=\"embedded\">".$stickyicon."<a $short_torrent_name_alt $mouseovertorrent href=\"details.php?id=".$id."&amp;hit=1\"><b>".htmlspecialchars($dispname)."</b></a>");
$sp_torrent = get_torrent_promotion_append($row['sp_state'],"",true,$row["added"], $row['promotion_time_type'], $row['promotion_until']);
$picked_torrent = "";
注意,上面红色字体用到的函数get_torrent_promotion_append()即是种子附加促销提示的显示模块。

Step1:添加一个功能函数:
为了不改变原来的功能,我们需要在后面copy一下该函数并进行修改(函数命名为get_torrent_promotion_append_sub(),并插入到原函数附近),修改后的代码如下:
---------------------
function get_torrent_promotion_append_sub($promotion = 1,$forcemode = "",$showtimeleft = false, $added = "", $promotionTimeType = 0, $promotionUntil = ''){
global $CURUSER,$lang_functions;
global $expirehalfleech_torrent, $expirefree_torrent, $expiretwoup_torrent, $expiretwoupfree_torrent, $expiretwouphalfleech_torrent, $expirethirtypercentleech_torrent;
$sp_torrent_sub = "";
$onmouseover_sub = "";
if (get_global_sp_state() == 1) {
switch ($promotion){
  case 2:
  {
   if ($showtimeleft && (($expirefree_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
   {
    if ($promotionTimeType == 2) {
     $futuretime = strtotime($promotionUntil);
    } else {
     $futuretime = strtotime($added) + $expirefree_torrent * 86400;
    }
    $timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
    if ($timeout)
       $onmouseover_sub = " (<font color='#0000FF'>".$lang_functions['text_will_end_in'].$timeout."</font>".")";    //free类型字符显示为蓝色,可以更改它
                else $promotion = 1;
   }
   break;
  }
  case 3:
  {
   if ($showtimeleft && (($expiretwoup_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
   {
    if ($promotionTimeType == 2) {
     $futuretime = strtotime($promotionUntil);
    } else {
     $futuretime = strtotime($added) + $expiretwoup_torrent * 86400;
    }
    $timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
    if ($timeout)
          $onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
                else $promotion = 1;
   }
   break;
  }
  case 4:
  {
   if ($showtimeleft && (($expiretwoupfree_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
   {
    if ($promotionTimeType == 2) {
     $futuretime = strtotime($promotionUntil);
    } else {
     $futuretime = strtotime($added) + $expiretwoupfree_torrent * 86400;
    }
    $timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
    if ($timeout)
    $onmouseover_sub = " (<font color='#00CC66'>".$lang_functions['text_will_end_in'].$timeout."</font>".")";  //2XFree 显示为青色,可以更改它
                else $promotion = 1;
   }
   break;
  }
  case 5:
  {
   if ($showtimeleft && (($expirehalfleech_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
   {
    if ($promotionTimeType == 2) {
     $futuretime = strtotime($promotionUntil);
    } else {
     $futuretime = strtotime($added) + $expirehalfleech_torrent * 86400;
    }
    $timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
    if ($timeout)
                $onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
    else $promotion = 1;
   }
   break;
  }
  case 6:
  {
   if ($showtimeleft && (($expiretwouphalfleech_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
   {
    if ($promotionTimeType == 2) {
     $futuretime = strtotime($promotionUntil);
    } else {
     $futuretime = strtotime($added) + $expiretwouphalfleech_torrent * 86400;
    }
    $timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
    if ($timeout)
       $onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
                else $promotion = 1;
   }
   break;
  }
  case 7:
  {
   if ($showtimeleft && (($expirethirtypercentleech_torrent && $promotionTimeType == 0) || $promotionTimeType == 2))
   {
    if ($promotionTimeType == 2) {
     $futuretime = strtotime($promotionUntil);
    } else {
     $futuretime = strtotime($added) + $expirethirtypercentleech_torrent * 86400;
    }
    $timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, false, true, false, true);
    if ($timeout)
       $onmouseover_sub = " (".$lang_functions['text_will_end_in'].$timeout.")";
                else $promotion = 1;
   }
   break;
  }
}
}
if (($CURUSER['appendpromotion'] == 'word' && $forcemode == "" ) || $forcemode == 'word'){
  if(($promotion==2 && get_global_sp_state() == 1) || get_global_sp_state() == 2){
            $sp_torrent_sub = $onmouseover_sub;
  }
  elseif(($promotion==3 && get_global_sp_state() == 1) || get_global_sp_state() == 3){
   $sp_torrent_sub = $onmouseover_sub;
        }
  elseif(($promotion==4 && get_global_sp_state() == 1) || get_global_sp_state() == 4){
            $sp_torrent_sub = $onmouseover_sub;
  }
  elseif(($promotion==5 && get_global_sp_state() == 1) || get_global_sp_state() == 5){
   $sp_torrent_sub = $onmouseover_sub;
  }
  elseif(($promotion==6 && get_global_sp_state() == 1) || get_global_sp_state() == 6){
      $sp_torrent_sub = $onmouseover_sub;
  }
  elseif(($promotion==7 && get_global_sp_state() == 1) || get_global_sp_state() == 7){
   $sp_torrent_sub = $onmouseover_sub;
        }
}
elseif (($CURUSER['appendpromotion'] == 'icon' && $forcemode == "") || $forcemode == 'icon'){
  if(($promotion==2 && get_global_sp_state() == 1) || get_global_sp_state() == 2)
   $sp_torrent_sub = $onmouseover_sub;
       elseif(($promotion==3 && get_global_sp_state() == 1) || get_global_sp_state() == 3)
   $sp_torrent_sub = $onmouseover_sub;
  elseif(($promotion==4 && get_global_sp_state() == 1) || get_global_sp_state() == 4)
       $sp_torrent_sub = $onmouseover_sub;
        elseif(($promotion==5 && get_global_sp_state() == 1) || get_global_sp_state() == 5)
      $sp_torrent_sub = $onmouseover_sub;
      elseif(($promotion==6 && get_global_sp_state() == 1) || get_global_sp_state() == 6)
   $sp_torrent_sub = $onmouseover_sub;
   elseif(($promotion==7 && get_global_sp_state() == 1) || get_global_sp_state() == 7)
      $sp_torrent_sub = $onmouseover_sub;        
}
return $sp_torrent_sub;
}

---------------------

Step2:功能调用
游客,如果您要查看本帖隐藏内容请回复

到此完工,查看效果:


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 点赞

使用道具 举报

lihesuoLv.4 发表于 2010-10-4 08:16:39 | 显示全部楼层
好多代码,看不懂
回复 点赞

使用道具 举报

6kun 发表于 2010-10-29 01:01:20 | 显示全部楼层
好多代码看看太累了
回复 点赞

使用道具 举报

asea1718Lv.2 发表于 2010-11-3 19:22:47 | 显示全部楼层
回复 17# starx


    看看到底有多强悍!!!
回复 点赞

使用道具 举报

回复

懒得打字嘛,点击右侧快捷回复 【本站酷狼4T,750元】
您需要登录后才可以回帖 登录 | 注册

本版积分规则

投诉/建议联系

support@gebi1.cn

未经授权禁止转载,复制和建立镜像,
如有违反,追究法律责任
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2024 隔壁网 版权所有 All Rights Reserved. 粤ICP备14056481号-1
关灯 在本版发帖
扫一扫添加微信客服
返回顶部
快速回复 返回顶部 返回列表