Get recursive list of children [SOLVED]
Posted: Sun Feb 21, 2010 9:35 pm
Hello.
I would like to be able to get a recursive array of the children of a page. This would be much like $cgsimple->get_children except that it would need to include children of children (ie grand children, great grand children etc).
So in the following example (which is fictitious):
1 Home
2 About
2.1 Who we are
2.2 Mission
2.2.1 Vision
the children of About are:
-Who we are
-Mission
-Vision.
[EDIT] Using the UDT that Peciura created (see below) works slightly different. It takes a hierarchical position to find the children are (in example: using the structure above, get the children of page #2, not about). It returns page aliases. It will also include the page itself, in example: if you said to get the children of page 2, you would get these aliases in the array (assuming the navigation structure above): about, who-we-are, mission, vision.
Thanks in advance.
Isaac.
I would like to be able to get a recursive array of the children of a page. This would be much like $cgsimple->get_children except that it would need to include children of children (ie grand children, great grand children etc).
So in the following example (which is fictitious):
1 Home
2 About
2.1 Who we are
2.2 Mission
2.2.1 Vision
the children of About are:
-Who we are
-Mission
-Vision.
[EDIT] Using the UDT that Peciura created (see below) works slightly different. It takes a hierarchical position to find the children are (in example: using the structure above, get the children of page #2, not about). It returns page aliases. It will also include the page itself, in example: if you said to get the children of page 2, you would get these aliases in the array (assuming the navigation structure above): about, who-we-are, mission, vision.
Thanks in advance.
Isaac.