将子项添加到第二级

编程入门 行业动态 更新时间:2024-10-11 01:20:30
本文介绍了将子项添加到第二级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我已经手动创建了主链接。是节点的链接(内容类型页面)喜欢

- 关于 - 关于我们 - 关于公司

我需要添加子项关于/关于company / company1 和关于/关于公司/公司2 从我的模块。

下一行在第一级创建菜单项(在一个级别与 - 关于)

$ items ['about2 '] = array('menu_name'=>'primary-links','title'=>'About2','page callback'=>'ninegm_about2' 'access callback'=> TRUE,'weight'=> -10,);

解决方案

查看 Drupal API 网站。菜单项和分层组织的路径由您定义新菜单项时传递给$项的键决定。现在你正在制作一个全新的顶级菜单项。

所以你需要用一些类似的东西代替 $ items ['about2']这是:

$ items ['关于/关于公司/约2'] =数组( //菜单项定义的其余部分...

这将使新菜单项在其路径中的菜单项的子项,所以它会出来看起来像这样:

- 关于

- 关于公司

---关于2

这是假设你的根目录的路径是关于页面是关于,你的关于公司页面的路径是关于公司,如果不是这样,只需将它们替换成这些页面的真实路径。

I have primary links created manually. The are links to node (content type 'page') like

-About --About Us --About company

I need to add subitems About/About company/company1 and About/About company/company2 from my module.

Next lines create menu item in first level (in one level with -About)

$items['about2'] = array( 'menu_name' => 'primary-links', 'title' => 'About2', 'page callback' => 'ninegm_about2', 'access callback' => TRUE, 'weight' => -10, );

解决方案

Check out the documentation at the Drupal API site. The path of the menu item, and the hierarchical organization, is determined by the key you pass to $items when defining a new menu item. Right now you are making a completely new top-level menu item.

So you need to replace $items['about2'] with something like this:

$items['About/About company/about2'] = array( //rest of menu item definition . . .

This will make the new menu item a child of the menu items in its path, so it will come out looking like this:

-About

--About Company

---About2

This is assuming the path to your root about page is "About", and the path to your About Company page is "About company". If that isn't true, just replace them with the real paths to those pages.

更多推荐

将子项添加到第二级

本文发布于:2023-11-12 11:18:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581347.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:到第   将子项

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!