如何在Drupal 7中打印自定义菜单? [英] How to print a custom menu in Drupal 7?
问题描述
我命名了我的新菜单站点菜单
在我的page.tpl.php中,我想要我的菜单出现我已经把它放到位:
<?php print theme('links',menu_navigation_links('menu-site-menu')); ?>
清除缓存并刷新我的页面后,我的菜单不会显示。
我被骗了任何帮助将不胜感激。
Berdir答案是正确的。 Drupal 7的theme_links函数也更加大量地使用数组。例如,如果你想添加另一个类名,那么你可以这样编码:
?php print theme('links',array('links'=> menu_navigation_links('menu-site-menu'),'attributes'=> array('class'=> array('links' -menu'))));?>
I have created a menu in Drupal 7 and created links to pages under that menu.
I named my new menu "Site Menu"
In my page.tpl.php where I want my menu to appear I have put this in place:
<?php print theme('links', menu_navigation_links('menu-site-menu')); ?>
After I have cleared my cache and refreshed my page my menu doesn't appear.
I am stumped. Any help would be greatly appreciated.
Berdir answer is correct. Drupal 7 theme_links function also more vastly uses arrays. For example if you would like to add another class name to the so that it is you would code it like this:
<?php print theme('links', array('links' => menu_navigation_links('menu-site-menu'), 'attributes' => array('class'=> array('links', 'site-menu')) ));?>
这篇关于如何在Drupal 7中打印自定义菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!