分页: 1 / 1

Nexusphp 系统设置自定义菜单

发表于 : 2026年 1月 14日 14:36
likeweixue
比如大家安装nexusphp 了之后的默认菜单是这种
图片

如果是要自定义,比如删除,修改(添加)之类的,可以这样子做;
去这个 php 文件,根目录/include/functions.php

找到大概是在 2338 行的位置(nexusphp v1.9.13 开源版本)

代码: 全选

 print ("<li" . ($selected == "home" ? " class=\"selected\"" : "") . "><a href=\"index.php\">" . $lang_functions['text_home'] . "</a></li>");
        if ($enableextforum != 'yes')
            print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"forums.php\">".$lang_functions['text_forums']."</a></li>");
        else
            print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"" . $extforumurl."\" target=\"_blank\">".$lang_functions['text_forums']."</a></li>");
        print ("<li" . ($selected == "torrents" ? " class=\"selected\"" : "") . "><a href=\"torrents.php\" rel='sub-menu'>".($normalSectionName[$lang] ?? $lang_functions['text_torrents'])."</a></li>");
        if ($enablespecial == 'yes' && user_can('view_special_torrent'))
            print ("<li" . ($selected == "special" ? " class=\"selected\"" : "") . "><a href=\"special.php\">".($specialSectionName[$lang] ?? $lang_functions['text_special'])."</a></li>");
        if ($enableoffer == 'yes')
            print ("<li" . ($selected == "offers" ? " class=\"selected\"" : "") . "><a href=\"offers.php\">".$lang_functions['text_offers']."</a></li>");
        if ($enablerequest == 'yes')
            print ("<li" . ($selected == "requests" ? " class=\"selected\"" : "") . "><a href=\"viewrequests.php\">".$lang_functions['text_request']."</a></li>");
        print ("<li" . ($selected == "upload" ? " class=\"selected\"" : "") . "><a href=\"upload.php\">".$lang_functions['text_upload']."</a></li>");
        print ("<li" . ($selected == "subtitles" ? " class=\"selected\"" : "") . "><a href=\"subtitles.php\">".$lang_functions['text_subtitles']."</a></li>");
        //	print ("<li" . ($selected == "usercp" ? " class=\"selected\"" : "") . "><a href=\"usercp.php\">".$lang_functions['text_user_cp']."</a></li>");
        if (user_can('topten')) {
            print ("<li" . ($selected == "topten" ? " class=\"selected\"" : "") . "><a href=\"topten.php\">".$lang_functions['text_top_ten']."</a></li>");
        }
        if (user_can('log')) {
            print ("<li" . ($selected == "log" ? " class=\"selected\"" : "") . "><a href=\"log.php\">".$lang_functions['text_log']."</a></li>");
        }
        print ("<li" . ($selected == "rules" ? " class=\"selected\"" : "") . "><a href=\"rules.php\">".$lang_functions['text_rules']."</a></li>");
        print ("<li" . ($selected == "faq" ? " class=\"selected\"" : "") . "><a href=\"faq.php\">".$lang_functions['text_faq']."</a></li>");
        if (user_can('staffmem')) {
            print ("<li" . ($selected == "staff" ? " class=\"selected\"" : "") . "><a href=\"staff.php\">".$lang_functions['text_staff']."</a></li>");
        }
        print ("<li" . ($selected == "contactstaff" ? " class=\"selected\"" : "") . "><a href=\"contactstaff.php\">".$lang_functions['text_contactstaff']."</a></li>");
        print ("</ul>");
这里面要看懂一些英文,你才知道要加在那个位置,比如我要在“论坛”的右边➕一个叫“官组”的标准,那么就需要在论坛的那一行代码下面添加(如果是想加的论坛的左边,那就添加在论坛代码的上面)。
比如论坛的代码是;

代码: 全选

print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"forums.php\">".$lang_functions['text_forums']."</a></li>");
        else
            print ("<li" . ($selected == "forums" ? " class=\"selected\"" : "") . "><a href=\"" . $extforumurl."\" target=\"_blank\">".$lang_functions['text_forums']."</a></li>");
ok,现在知道要加的位置,还需要知道加的代码是什么。
首先呢,菜单就两个左右,让别人知道这个菜单叫什么名字,点击之后跳转到哪里(是在新的标签页打开还在 目前的标签页打开)。

第一种情况,内部页面菜单;

代码: 全选

// 1. 内部页面菜单
print ("<li><a href=\"填写需要跳转的位置,也就是网址\">菜单名字</a></li>");
第二种情况,外部链接菜单(新窗口打开);

代码: 全选

print ("<li><a href=\"填写需要跳转的位置,也就是网址\" target=\"_blank\" rel=\"noopener noreferrer\">菜单的名字</a></li>");
特殊情况,比如你是想打开某个php 文件,那么你可以把这个 php 文件放在 运行目录public 下面,比如“ public/我要打开的文件.php”
这种的话,菜单链接的地方就可以写成

代码: 全选

我要打开的文件.php
比如

代码: 全选

// 1. 内部页面菜单
print ("<li><a href=\"我要打开的文件.php\">菜单名字</a></li>");
下面是效果图
图片

番外篇;下面是一些高级功能(小白不建议尝试),DeepSeek 写的;
如果你想根据用户权限显示菜单:

代码: 全选

// 普通用户都显示
print ("<li><a href=\"mypage.php\">我的页面</a></li>");

// 只有VIP以上用户显示
if ($CURUSER && $CURUSER['class'] >= UC_VIP) {
    print ("<li><a href=\"vip_page.php\">VIP功能</a></li>");
}

// 只有管理员显示
if (user_can('staffmem')) {
    print ("<li><a href=\"admin_page.php\">管理功能</a></li>");
}

ok,快去试一试吧,不懂的就问 DeepSeek。