Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $group_counts = 6; // The number of entries per menu
- $tree_array = array_filter(explode("\n", $tree) , "trim");
- $str_trees = "";
- $leafs = array();
- $tree_count = 0;
- foreach($tree_array as $li_entry){
- $leafs[] = $li_entry;
- if (count($leafs) == $group_counts){
- $str_trees .= "\n<ul class=\"menu tree-". ++$tree_count ." \">\n". implode("\n", $leafs) ."\n</ul>\n";
- $leafs = array(); // reset the leafs on this tree
- }
- }
- // Clean up any straggelers
- if (count($leafs)){
- $str_trees .= "\n<ul class=\"menu tree-". ++$tree_count ." \">\n". implode("\n", $leafs) ."\n</ul>\n";
- $trees = array();
- }
- return $str_trees;
Add Comment
Please, Sign In to add comment