Project:Node Relativity
Version:master
Component:Code
Category:task
Priority:normal
Assigned:Levi DeHaan
Status:needs review

Issue Summary

Hello guys,
I found this function to be very useful and there wasn't much in the way of retrieving the children, lots of functions for parents
but only two for children, this is an output for themeing or pulling specific data if you need it.
used in themes it is very functional in order to just grab the children of a parent. you don't have anything currently that does this.
thanks for this great module,
-=Levi=-

/**
* Loads children nodes
* $parent - pass $node in call, or just pass the nid, whatever works best for you.
*/
function get_children_nodes($parent)
{
is_object($parent) ? $result = db_query('SELECT nid FROM {relativity} WHERE parent_nid = %d', $parent->nid) : $result = db_query('SELECT nid FROM {relativity} WHERE parent_nid = %d', $parent);
while($child = db_fetch_object($result))
{
$child_nodes[] = node_load($child->nid);
}
if (!is_array($child_nodes)) { return 'error'; }
return $child_nodes;
}

nobody click here