Guest User

Untitled

a guest
Jan 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. $group_counts = 6; // The number of entries per menu
  2. $tree_array = array_filter(explode("\n", $tree) , "trim");
  3. $str_trees = "";
  4. $leafs = array();
  5. $tree_count = 0;
  6.  
  7. foreach($tree_array as $li_entry){
  8. $leafs[] = $li_entry;
  9. if (count($leafs) == $group_counts){
  10. $str_trees .= "\n<ul class=\"menu tree-". ++$tree_count ." \">\n". implode("\n", $leafs) ."\n</ul>\n";
  11. $leafs = array(); // reset the leafs on this tree
  12. }
  13. }
  14.  
  15. // Clean up any straggelers
  16. if (count($leafs)){
  17. $str_trees .= "\n<ul class=\"menu tree-". ++$tree_count ." \">\n". implode("\n", $leafs) ."\n</ul>\n";
  18. $trees = array();
  19. }
  20.  
  21. return $str_trees;
Add Comment
Please, Sign In to add comment