On May 18, 4:12 pm, Walther <waltherl...@gmail.com> wrote:
> I am using the tree behaviour in conjunction with the jQuery tree 
> atwww.jstree.comto create a admin interface for a forum that allows
> multiple and unlimited subforums.
>
> It is working quite well.
>
> The only problem is that jstree doesn't tell you how far a node has
> been moved, but rather gives a reference node and tells you if the
> item was moved after, before or inside the reference node (Inside
> meaning it is now a subnode, after meaning that it moved upwards and
> before meaning downwards).
>
> My problem is how do I calculate the distance between two nodes (With
> the same parent id) if I only know what the two nodes are? Currently I
> am calculating the difference in lft values between the nodes, but it
> does not always give correct values.

the lft and rght values alone do not give you the info you're looking
for.
>
> So, what is the recommended method for calculating the distance
> between two nodes in a MPTT tree?

$difference = $Model->find('count', array('conditions' => array
('parent_id' => $thisone, 'lft BETWEEN' => array($first['lft'], $last
['lft'])));

style.

hth,

AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to