为什么我的 drupal 7 子菜单没有显示?
我似乎无法显示我的子菜单。
我已经转到:主页 » 管理 » 结构 » 菜单
然后,我编辑了父菜单并选中了“显示为展开”的复选框 - 但仍然什么也没有。
我所指的导航的 page.tpl.php 页面上的代码如下:
<?php
if ($page['navigation'] || $main_menu):
?>
<?php
print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'nav',
'class' => array('links', 'clearfix'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
));
?>
<?php
print render($page['navigation']);
?>
<?php
endif;
?>
我做错了什么?
任何帮助将不胜感激。
I can't seem to get my sub-menus to display.
I've gone to: Home » Administration » Structure » Menus
Then, I've edited the parent menu and checked the tickbox that says "Show as expanded" - but still nothing.
The code on my page.tpl.php page for the navigation I'm referring to, is as follows:
<?php
if ($page['navigation'] || $main_menu):
?>
<?php
print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'nav',
'class' => array('links', 'clearfix'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
));
?>
<?php
print render($page['navigation']);
?>
<?php
endif;
?>
What am I doing wrong?
Any help would be GREATLY appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保选中父菜单“显示为展开”属性。
转到
admin/struct/menu/item/MENU_ITEM_ID/edit
,然后选中“显示为展开”Make sure that the parent menu "Show as expanded" attribute is checked.
Go to
admin/structure/menu/item/MENU_ITEM_ID/edit
, and check "Show as expanded"您可以使用随菜单生成的主菜单块,而不是使用 $main_menu 变量。
如果将“主菜单”块放入 admin/struct/block 的“导航”区域,则 page.tpl.php 中的 print render($page['navigation']) 将打印出完整的菜单,包括其子菜单菜单项(子项)。
只需确保在父菜单链接中勾选“显示为展开”选项即可。
最后,删除“打印主题”内容,否则您最终会得到双菜单。
page.tpl.php 看起来像这样:
Instead of using the $main_menu variable, you can use the main-menu block, which is generated with the menu.
If you put the "Main menu" block into the "Navigation" region at admin/structure/block, print render($page['navigation']) in the page.tpl.php will print out the complete menu, including its sub menu items (children).
Just make sure you tick the "Show as expanded" option in the parent menu link.
Lastly, remove the "print theme" stuff, otherwise you end up with double menu's.
the page.tpl.php will look something like this:
开箱即用的鲜明主题在主菜单中也不显示子菜单(2011/04)。
但是,如果您转到 admin/struct/blocks,并将菜单块拖到鲜明主题中的标题区域,它就会有子菜单。
然后您还会有两个菜单,一个是没有子菜单的原始菜单,另一个是带有子菜单的新菜单。您可以在 admin/appearance/stark/settings 中禁用原始的。
2c 美元,
*-派克
The stark theme out-of-the-box doesn't show submenuus in it's main menu either (2011/04).
If you however go to admin/structure/blocks, and drag the menu block to the header region in the stark theme, it has submenus.
You'll also have two menus then, the original one without submenus and the new one with submenus. You can disable the original one in admin/appearance/stark/settings.
$2c,
*-pike