void renumber_visitations(
$id, [ $parent = null])
|
|
Some useful "visitation model" tricks:
To find the number of child elements: (right - left - 1) / 2
To find the number of child elements (including self): (right - left + 1) / 2
To get all child nodes:
SELECT * FROM table WHERE left > <self.left> AND left < <self.right>
To get all child nodes, including self:
SELECT * FROM table WHERE left BETWEEN <self.left> AND <self.right> "ORDER BY left" gives tree view
To get all leaf nodes:
SELECT * FROM table WHERE right-1 = left;
Parameters