# Tree Helper A CakePHP helper to handle tree structures. By default, it uses the core TreeBehavior and MPTT (Modified Preorder Tree Traversal). But it sure can work with any tree like input as nested object or array structure. ### Usage #### Basic usage Include helper in your AppView class as ```php $this->addHelper('Tools.Tree', [ ... ]); ``` Then you can use it in your templates as ```php echo $this->Tree->generate($articles); ``` #### Templated usage By default, just outputting the display name is usually not enough. You want to create some `Template/Element/tree_element.ctp` element instead: ```php echo $this->Tree->generate($articles, ['element' => 'tree_element']); ``` That template can then contain all normal template additions, including full helper access: ```php visible) { // You can do anything here depending on the record content return; } ?>