XF 2.2 How to find child nodes?

Parsnip

Active member
Is there a simple way to get all child nodes of a parent category, or is the only way to iterate through the node tree looking at the parent_node_id?
 
I'm not in my office so can't check the code but there should be a parent node ID param.

Although that may only be the immediate parent, so children of children wouldn't be covered.
 
To get all descendants of a node, fetch all nodes that have a lft value larger or equal than your node and a rgt value smaller or equal than your node. You can then use the node repos node tree builder function to create a new partial node tree with your parent node as root element
 
Back
Top Bottom