Drupal 7 双行菜单
我正在使用 Drupal 7 开发一个网站。我已经正确设置了菜单和所有这些内容的样式。问题出在二级菜单上。
我的想法是在第一个菜单后面立即创建第二个菜单,例如:
MENU_ITEM1 |菜单项2 |菜单项3 |菜单_ITEM4
菜单_ITEM1_SUBITEM1 |菜单_项目1_SUBITEM2 | MENU_ITEM1_SUBITEM3
结构如下:
- MENU_ITEM1
- MENU_ITEM1_SUBITEM1
- MENU_ITEM1_SUBITEM2
- MENU_ITEM1_SUBITEM3
- MENU_ITEM2
- MENU_ITEM3
- MENU_ITEM4
第一个问题,我看不到次要项目 2. 关于如何创建这个有什么建议吗?
多谢!
I am developing a site with Drupal 7. I have styled the menu correctly and all this stuff. The problem is with the secondary menu.
My idea is to create the second menu immediatly behind the first menu, for example:
MENU_ITEM1 | MENU_ITEM2 | MENU_ITEM3 | MENU_ITEM4
MENU_ITEM1_SUBITEM1 | MENU_ITEM1_SUBITEM2 | MENU_ITEM1_SUBITEM3
And the structure goes like this:
- MENU_ITEM1
- MENU_ITEM1_SUBITEM1
- MENU_ITEM1_SUBITEM2
- MENU_ITEM1_SUBITEM3
- MENU_ITEM2
- MENU_ITEM3
- MENU_ITEM4
1st problem, I cannot see secondary items
2nd Any suggestion on how to create this?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 drupal 中构建具有多个级别的菜单,并选择该菜单(例如主菜单)作为源您的主链接和辅助链接,位于“/admin/struction/menu/settings”。
然后,您可以在 template.php 文件中实现 drupal 的 theme_preprocess_page() 函数:
现在您需要做的就是回显/打印新变量 (
$primary_links< /code> 和
$secondary_links
在本例中)现在可用于 page.tpl.php。You can structure your menu with multiple levels within drupal, and select that menu (e.g. main menu) as the source for both your main links and secondary links, over at "/admin/structure/menu/settings".
Then you can implement drupal's theme_preprocess_page() function in your template.php file:
Now all you need to do is echo/print the new variables (
$primary_links
&$secondary_links
in this case) now available to page.tpl.php.并非所有 drupal 主题都允许您像这样设置菜单样式。
如果您的主题支持嵌套菜单结构,则只需将菜单项嵌套在菜单设置中即可。幸运的是,由于拖放界面,drupal 可以很好地处理这个问题,您只需要确保任何顶级菜单项都选中了“扩展”框即可。
如果您想查看一个简单的示例,您可以查看“导航”菜单设置,它们已经嵌套和展开,因此您会知道主菜单设置应该是什么样子。
Not all drupal themes allow you to style your menus like this.
If you have a theme that supports nested menu structures, you just need to nest your menu items in the menu settings. Fortunately, drupal handles this relatively well thanks to the drag and drop interface, you just need to make sure that any of your top level menu items have the "expanded" box checked.
If you would like to see a quick example, you can just look at your "navigation" menu settings, they are already nested and expanded, so you'll know what your main menu settings should look like.