Hi,

I've got a PHP script running outside of Drupal but which calls the drupal bootstrapper.

The script creates newsletter links in my menu of the following structure, using menu_save_link:

Root
---| Blah
---| Newsletters
---| -------------| 2008
---| -------------| ---- January 2008
---| -------------| ---- February 2008
---| -------------| ---- March 2008
---| -------------| 2009
---| -------------| ---- January 2009
---| -------------| 2010
---| -------------| ---- January 2010
---| Blah
---| Blah

Currently the mlid value for each child 'year' is stored in the script, so if (year is 2009) then mlid = 415, if (year is 2010) then mlid = 423, etc, which I then use as the parent id (plid) when calling menu_link_save. (These values are made up for the sake of this post)

However, there's two things I want to do:

1) Determine the mlid of the 'year' child menu item dynamically, by searching the children of mlid 401 (= Newsletters) until I find it;
2) If the 'year' child menu item doesn't exist (eg 2011) then create it first.

I can do number (2) easily once number (1) is sorted. Is there a way of doing number (1)?

Ideally i'd like a function along the lines of:

child_Mlid ($year)
{

if (isset(mlid))
{
return mlid;
}
else
{
return false;
}
}

I'm happy to construct this function myself, if someone can guide me towards how to determine the children of a given menulink, and what their name value is?

I've read through the APIs but not found how to determine the children of an menulink.

Cheers,

Peter