Friday 15 March 2013

php - Manually Building a Tree in CakePHP -


I am currently working on creating an application in CakePHP. There is a fairly comprehensive current data set which is a tree but was not stored as the first one, what does that mean, there is no real relationship defined in the data.

The problem I have is that cake is working properly with the behavior of the php tree. Because I have to set all the values ​​on the existing data - as the structure of the cake is set in the form of elements - I need to understand how Lft / RGTT values ​​work.

So, I think the question is:

How does the structure data work, especially the lft / rght values? How can I set it so that the data is rationally excluded, at one time without inserting them into one? This is a 2-level tree, with sections and sub-squares.

Thanks for the help

MPTT tree logic is rather simple and well in Explained. In essence, there is a left and right value in each entry, every entry left / right value is within another entry, which is the left-right border, the descendant of that (later) element such as the LCD node (5 / 6) is within the limits of your parent node, television (2-9).

To create lft / rght values ​​for a "new", set the tree properly to all parent_ids and run on it. The cake will calculate the LFT / RGTT values ​​for you.


No comments:

Post a Comment