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
- Sports
- Foot开发者_JS百科ball
- Cricket
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
精彩评论