开发者

how to list children pages in drupal 6

Using the node api i would like to create an array of children nodes.

for example in the menu say i had

How can i list these in php


Assuming you want your hierarchy to be managed from a Drupal menu, you can do this:

start with:

$data = menu_tree_page_data('menu-name')

The children live in the data in something like this:

$data['LONG-KEY MENU-NAME MENU-ID']['below'])

I usually do a little print_r($data,true) to identify the actual key of $data where the children live.. the key naming structure is a little odd to me.. it's not terribly intuitive.

There's a lot going on in the data array there.. more than you need to get an array of children nodes..

I've got an in-depth blog post on this (but geared toward menu implementation rather than a node api list of nodes..) here: http://www.trevorsimonton.com/blog/sub-menu-children-menu-items-block-menu-children-blocks-sibling

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜