默认展开 Drupal 菜单

发布于 2024-08-03 21:15:22 字数 165 浏览 5 评论 0原文

对于菜单系统,有没有办法设置其中一个菜单项默认展开?我无法让我的主菜单项在主页上展开(至少),并且我希望在其他菜单项未展开时将其展开。

我正在使用 Drupal 5 和分类菜单模块。分类菜单对于我 95% 的页面来说非常好,但有些是静态的“关于我们”类型页面,我希望将主菜单作为默认页面,然后是主页。

For the menu system, is there a way to set one of the menu items to be expanded by default? I can't get my home menu item to be expanded on the homepage (at the least), and I'd like it to be expanded whenever one of the other ones isn't.

I'm using Drupal 5, and the Taxonomy Menu module. Taxonomy Menu is pretty good with 95% of my pages, but some are static "About Us" type pages, which I'd like to have the home menu as default for, and then there's the homepage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

陌生 2024-08-10 21:15:22

好吧,我想我找到了一个(悲伤的)答案。从 Drupal 网页上的一个 问题 来看,“正如所显示的,菜单系统Drupal 5 已损坏,并且不会再修复”。因此,我正在寻找一种新的方法来进行 Drupal 菜单系统之外的顶部导航。

解决方案:
我最终将导航系统放在 page.tpl.php 中。根据节点的内容(我从面包屑中提取分类法),它选择突出显示哪个节点,但默认为主页。它比我想要的更黑客,但它有效。

Well, I think I found a (sad) answer. From an issue on the Drupal webpage, "as it appears, the menu system of Drupal 5 is broken and won't be fixed anymore". So I'm finding a new way to do the top navigation that goes outside of Drupal's menu system.

Solution:
I ended up putting the navigation system in page.tpl.php. Based on the content of the nodes (I'm pulling the taxonomy from the breadcrumb), it chooses which one is highlighted, but defaults to home. It's hackier than I'd like, but it works.

甜扑 2024-08-10 21:15:22
/**
 * Implementation of hook_menu_link_alter().
 *
 */
function module_menu_link_alter(&$item, $menu) {
    if($item['menu_name'] == 'primary-links') {
        $item['expanded'] = 1;
    }
}
/**
 * Implementation of hook_menu_link_alter().
 *
 */
function module_menu_link_alter(&$item, $menu) {
    if($item['menu_name'] == 'primary-links') {
        $item['expanded'] = 1;
    }
}
终遇你 2024-08-10 21:15:22

如果您没有在 Drupal 5 上投入太多,那么升级到 Drupal 6 可能是值得的。您所要做的就是管理相关菜单并勾选“扩展”选项......

It might be worth upgrading to Drupal 6 if you don't have too much invested in Drupal 5. Then all you have to do is administer the relevant menu and tick the "Expanded" option for it...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文