Hi. I'm trying to order a tree such that for any given node on the tree, all its children appear alphabetically, including the top level.
If I understand the reorder() method correctly (it has sparse documentation at http://book.cakephp.org/view/229/Advanced-Usage#reorder-518 but the API at http://api.cakephp.org/class/tree-behavior#method-TreeBehaviorreorder is more informative), then you need to pass it the IDs that need editing. I want to reorder the whole entire tree though, so I made my own reorderAll() method in /app/app_model.php: function reorderAll($options = array()) { $parentIDs = $this->find('list', array( 'fields' => array( 'parent_id' ) )); $parentIDs = array_unique($parentIDs); foreach ($parentIDs as $parentID) { if (!empty($parentID)) { $options['id'] = $parentID; $this->reorder($options); } } } Is this a good way of approaching it? The most obvious problem I can see at the moment is that the top level still isn't getting alphabetised, and I'm not sure how to do this. I'm also still not sure if reorder() recurses as far as it can, or just one level. Thanks for any help or suggestions! Zoe. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
