如何在 Drupal 7 中打印自定义菜单? [英] How to print a custom menu in Drupal 7?

查看:19
本文介绍了如何在 Drupal 7 中打印自定义菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Drupal 7 中创建了一个菜单,并在该菜单下创建了指向页面的链接.

I have created a menu in Drupal 7 and created links to pages under that menu.

我将我的新菜单命名为站点菜单"

I named my new menu "Site Menu"

在我希望显示菜单的 page.tpl.php 中,我已将其放置到位:

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 的回答是正确的.Drupal 7 theme_links 函数也更广泛地使用数组.例如,如果您想向 中添加另一个类名,以便您可以这样编码:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆