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

首页、帮助、搜索、管理、监控中心、个人资料、我的消息、会员、注销
现在开始动手修改吧!
FTP路径:/Sources/Subs.php
找到这一行:
可以看到后面有这样的代码:
这里的 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'的代码:
'sub_buttons' => array()中,括号里填写的子菜单代码和普通菜单的代码格式是一样的。所以只要代码填入'sub_buttons' => array()的括号里,就可以实现子菜单功能。
先看看定制前的主菜单:

首页、帮助、搜索、管理、监控中心、个人资料、我的消息、会员、注销
现在开始动手修改吧!
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()的括号里,就可以实现子菜单功能。