Simple Machines Forum 默认主题Curve主菜单修改方法

本文介绍如何修改SMF2.0论坛软件Curve主题的主菜单,包括删除不需要的按钮及添加自定义菜单项的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

不得不说SMF 2.0的默认主题Curve比之前的各种主题都来得漂亮!不过他的主菜单(tab)按钮显得有些多,那么现在来定制一下。

先看看定制前的主菜单:

首页、帮助、搜索、管理、监控中心、个人资料、我的消息、会员、注销

现在开始动手修改吧!

FTP路径:/Sources/Subs.php
找到这一行:
// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first
可以看到后面有这样的代码:'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),

这里的 home, help, search 对应的就是主菜单上的首页、帮助、搜索按钮。那么只要按照它的格式和顺序往上添加就可以了。
比如home
'home' => array( //这个'home'是按钮名称,不会显示在界面上
'title' => $txt['home'], //这里才是显示的文字 可以使用全局变量,也可以使用字符串
'href' => $scripturl, //这是指向的URL
'show' => true, //填true就显示按钮 填false就隐藏按钮
'sub_buttons' => array( //'sub_buttons' 这里留空 如果需要下拉菜单则需要在 array(),这里填上内容
),
'is_last' => $context['right_to_left'],
),

下拉菜单(sub_buttons)的修改:
看按钮'pm'的代码:'pm' => array(
'title' => $txt['pm_short'],
'href' => $scripturl . '?action=pm',
'show' => $context['allow_pm'],
'sub_buttons' => array(
'pm_read' => array(
'title' => $txt['pm_menu_read'],
'href' => $scripturl . '?action=pm',
'show' => allowedTo('pm_read'),
),
'pm_send' => array(
'title' => $txt['pm_menu_send'],
'href' => $scripturl . '?action=pm;sa=send',
'show' => allowedTo('pm_send'),
'is_last' => true,
),
),
),

'sub_buttons' => array()中,括号里填写的子菜单代码和普通菜单的代码格式是一样的。所以只要代码填入'sub_buttons' => array()的括号里,就可以实现子菜单功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值